

def test_expand_dims_no_change(self):
    m = np.random.rand(3)
    x = mu.expand_dims(np.copy(m), 0)
    assert_equals(x.ndim, m.ndim)
    assert_equals(x.shape, m.shape)
    assert_true(np.any((x == m)))
    x = mu.expand_dims(np.copy(m), 1)
    assert_equals(x.ndim, m.ndim)
    assert_equals(x.shape, m.shape)
    assert_true(np.any((x == m)))
    m = np.random.rand(3, 2)
    for d in xrange(m.ndim):
        x = mu.expand_dims(np.copy(m), d)
        assert_equals(x.ndim, m.ndim)
        assert_equals(x.shape, m.shape)
        assert_true(np.any((x == m)))
    m = np.random.rand(3, 2, 5)
    for d in xrange(m.ndim):
        x = mu.expand_dims(np.copy(m), d)
        assert_equals(x.ndim, m.ndim)
        assert_equals(x.shape, m.shape)
        assert_true(np.any((x == m)))
    m = np.random.rand(5, 4, 3, 2)
    for d in xrange(m.ndim):
        x = mu.expand_dims(np.copy(m), d)
        assert_equals(x.ndim, m.ndim)
        assert_equals(x.shape, m.shape)
        assert_true(np.any((x == m)))

dataset/ETHPy150Open kashefy/nideep/nideep/blobs/test_mat_utils.py TestExpandDims.test_expand_dims_no_change/original