提交 ffacbc24 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

made verbose exception for elemwise perform

上级 21fea7fa
......@@ -8,8 +8,10 @@ from theano import gof
from theano.gof import Apply, Op
from theano import scalar
from theano.scalar import Scalar
from theano.printing import pprint
from theano.printing import min_informative_str, pprint
from theano.gof.python25 import all, any
config = theano.config
# tensor depends on elemwise to provide definitions for several ops
......@@ -685,8 +687,15 @@ class Elemwise(Op):
msg2 += [str(d)]
msg.append('(%s)' % ", ".join(msg2))
raise ValueError('Dimension mismatch; shapes are %s' %
', '.join(msg))
base_exc_str = 'Dimension mismatch; shapes are %s' % (', '.join(msg))
if config.exception_verbosity == 'high':
msg_chunks = [ base_exc_str ]
for i, ipt in enumerate(node.inputs):
msg_chunks.append('input %d: %s' % (i, min_informative_str(ipt)))
raise ValueError('\n'.join(msg_chunks))
else:
raise ValueError(base_exc_str)
#', '.join('(%s)' % ', '.join(msg)))
#backport
#raise ValueError('Dimension mismatch; shapes are %s' %
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论