(self)
| 626 | |
| 627 | class TestSqueeze: |
| 628 | def test_basic(self): |
| 629 | from numpy.random import rand |
| 630 | |
| 631 | a = rand(20, 10, 10, 1, 1) |
| 632 | b = rand(20, 1, 10, 1, 20) |
| 633 | c = rand(1, 1, 20, 10) |
| 634 | assert_array_equal(np.squeeze(a), np.reshape(a, (20, 10, 10))) |
| 635 | assert_array_equal(np.squeeze(b), np.reshape(b, (20, 10, 20))) |
| 636 | assert_array_equal(np.squeeze(c), np.reshape(c, (20, 10))) |
| 637 | |
| 638 | # Squeezing to 0-dim should still give an ndarray |
| 639 | a = [[[1.5]]] |
| 640 | res = np.squeeze(a) |
| 641 | assert_equal(res, 1.5) |
| 642 | assert_equal(res.ndim, 0) |
| 643 | assert_equal(type(res), np.ndarray) |
| 644 | |
| 645 | |
| 646 | class TestKron: |
nothing calls this directly
no test coverage detected