(self)
| 655 | |
| 656 | class TestSqueeze: |
| 657 | def test_basic(self): |
| 658 | from numpy.random import rand |
| 659 | |
| 660 | a = rand(20, 10, 10, 1, 1) |
| 661 | b = rand(20, 1, 10, 1, 20) |
| 662 | c = rand(1, 1, 20, 10) |
| 663 | assert_array_equal(np.squeeze(a), np.reshape(a, (20, 10, 10))) |
| 664 | assert_array_equal(np.squeeze(b), np.reshape(b, (20, 10, 20))) |
| 665 | assert_array_equal(np.squeeze(c), np.reshape(c, (20, 10))) |
| 666 | |
| 667 | # Squeezing to 0-dim should still give an ndarray |
| 668 | a = [[[1.5]]] |
| 669 | res = np.squeeze(a) |
| 670 | assert_equal(res, 1.5) |
| 671 | assert_equal(res.ndim, 0) |
| 672 | assert_equal(type(res), np.ndarray) |
| 673 | |
| 674 | |
| 675 | class TestKron: |
nothing calls this directly
no test coverage detected