提交 996396ef authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix a test in debug mode.

上级 8da237d2
...@@ -862,14 +862,20 @@ SecondSameRankTester = makeTester( ...@@ -862,14 +862,20 @@ SecondSameRankTester = makeTester(
) )
def test_eye(): def test_eye():
def check(dtype, N, M=None, k=0): def check(dtype, N, M_=None, k=0):
# Theano don't accept None as a tendor
# So we must use a real value.
M = M_
# Currently DebugMode don't support None as inputs event if this is allowed.
if M is None and theano.config.mode in ['DebugMode', 'DEBUG_MODE']:
M = N
N_symb = tensor.iscalar() N_symb = tensor.iscalar()
M_symb = tensor.iscalar() M_symb = tensor.iscalar()
k_symb = tensor.iscalar() k_symb = tensor.iscalar()
f = function([N_symb, M_symb, k_symb], f = function([N_symb, M_symb, k_symb],
eye(N_symb, M_symb, k_symb, dtype=dtype)) eye(N_symb, M_symb, k_symb, dtype=dtype))
result = f(N, M, k) result = f(N, M, k)
assert numpy.allclose(result, numpy.eye(N, M, k, dtype=dtype)) assert numpy.allclose(result, numpy.eye(N, M_, k, dtype=dtype))
assert result.dtype == numpy.dtype(dtype) assert result.dtype == numpy.dtype(dtype)
for dtype in ALL_DTYPES: for dtype in ALL_DTYPES:
yield check, dtype, 3 yield check, dtype, 3
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论