提交 08d61b24 authored 作者: Frederic's avatar Frederic

Make simpler tests that was crashing as I restricted too much the exception catched.

I review the code, we always put a tuple or a Theano variable in that list. We only want to work with the tuple case. So just test for the tuple. We don't want to cover the case where we have a Theano vector with a know lenght.
上级 b5a5a951
...@@ -1384,18 +1384,11 @@ def _gemm_from_factored_list(lst): ...@@ -1384,18 +1384,11 @@ def _gemm_from_factored_list(lst):
for sM in lst: for sM in lst:
# Make every pair in list have matching dtypes # Make every pair in list have matching dtypes
# sM can be a tuple of 2 elements or a theano variable. # sM can be a tuple of 2 elements or a theano variable.
# We should not use __len__ as theano variables don't support if isinstance(sM, tuple):
# it. I don't want to change this to isinstance(sM, tuple)
# as I'm not able to make a test that triggers this case.
try:
sm0, sm1 = sM sm0, sm1 = sM
sm0 = T.as_tensor_variable(sm0) sm0 = T.as_tensor_variable(sm0)
if theano.scalar.upcast(sm0.dtype, sm1.dtype) == sm1.dtype: if theano.scalar.upcast(sm0.dtype, sm1.dtype) == sm1.dtype:
lst2.append((T.cast(sm0, sm1.dtype), sM[1])) lst2.append((T.cast(sm0, sm1.dtype), sM[1]))
except ValueError:
# "ValueError: length not known" is raised by
# "sm0, sm1 = sM" when sM is a Theano variable
pass
lst = lst2 lst = lst2
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论