提交 224e2b8d authored 作者: Dustin Webb's avatar Dustin Webb

Reworked reshape test to ensure that atleast one -1 value is permitted.

上级 5659f1e0
...@@ -339,12 +339,12 @@ def test_reshape(): ...@@ -339,12 +339,12 @@ def test_reshape():
# Test for appropriate handling of -1 indices # Test for appropriate handling of -1 indices
x = T.tensor3('x') x = T.tensor3('x')
dim = T.scalar('dim_val', dtype='int32')
reshp_val = numpy.array([[[1, 0], [0, 1]], [[0, 1], [1, 0]]], dtype='float32') reshp_val = numpy.array([[[1, 0], [0, 1]], [[0, 1], [1, 0]]], dtype='float32')
f_reshp = theano.function([x, dim], x.reshape((dim, 1, 1)), mode=mode_with_gpu) f_reshp = theano.function([x], x.reshape((-1, 1, 1)), mode=mode_with_gpu)
y = f_reshp(reshp_val, -1) y = f_reshp(reshp_val)
assert y.shape == (8, 1, 1) assert y.shape == (8, 1, 1)
dim = T.scalar('dim_val', dtype='int32')
f_reshp=theano.function( f_reshp=theano.function(
[x, dim], [x, dim],
x.reshape((dim, dim, 1)), x.reshape((dim, dim, 1)),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论