提交 42382811 authored 作者: affanv14's avatar affanv14

Add test for empty list indexing

上级 b4c41d22
...@@ -26,6 +26,19 @@ def test_numpy_method(): ...@@ -26,6 +26,19 @@ def test_numpy_method():
np.nan_to_num(fct(data))) np.nan_to_num(fct(data)))
def test_empty_list_indexing():
ynp = np.zeros((2, 2))[:, []]
znp = np.zeros((2, 2))[:, ()]
data = [[0, 0], [0, 0]]
x = tt.dmatrix('x')
y = x[:, []]
z = x[:, ()]
fy = theano.function([x], y)
fz = theano.function([x], z)
assert_equal(fy(data).shape, ynp.shape)
assert_equal(fz(data).shape, znp.shape)
def test_copy(): def test_copy():
x = tt.dmatrix('x') x = tt.dmatrix('x')
data = np.random.rand(5, 5) data = np.random.rand(5, 5)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论