提交 29c92ffc authored 作者: Frederic Bastien's avatar Frederic Bastien

catch the appropriate error.

上级 2b8ea5da
...@@ -1190,7 +1190,7 @@ class _tensor_py_operators: ...@@ -1190,7 +1190,7 @@ class _tensor_py_operators:
try: try:
for i in xrange(get_vector_length(self)): for i in xrange(get_vector_length(self)):
yield self[i] yield self[i]
except: except TypeError, e:
# This prevents accidental iteration via builtin.sum(self) # This prevents accidental iteration via builtin.sum(self)
raise TypeError('TensorType does not support iteration. ' raise TypeError('TensorType does not support iteration. '
'Maybe you are using builtin.sum instead of theano.tensor.sum? (Maybe .max?)') 'Maybe you are using builtin.sum instead of theano.tensor.sum? (Maybe .max?)')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论