提交 55ceca97 authored 作者: Frederic Bastien's avatar Frederic Bastien 提交者: sentient07

speed up compilation with exception_verbosity=high

上级 587d51fe
...@@ -2690,15 +2690,18 @@ class Alloc(gof.Op): ...@@ -2690,15 +2690,18 @@ class Alloc(gof.Op):
sh = [as_tensor_variable(s) for s in shape] sh = [as_tensor_variable(s) for s in shape]
bcast = [] bcast = []
for i, s in enumerate(sh): for i, s in enumerate(sh):
if config.exception_verbosity == 'high': def err_str():
s_as_str = '\n' + min_informative_str(s) if config.exception_verbosity == 'high':
else: return '\n' + min_informative_str(s)
s_as_str = str(s) else:
return str(s)
if s.type.dtype[:3] not in ('int', 'uin'): if s.type.dtype[:3] not in ('int', 'uin'):
s_as_str = err_str()
raise TypeError('Shape arguments to Alloc must be integers, ' raise TypeError('Shape arguments to Alloc must be integers, '
'but argument %s is not for apply node: %s' % 'but argument %s is not for apply node: %s' %
(i, s_as_str)) (i, s_as_str))
if s.ndim != 0: if s.ndim != 0:
s_as_str = err_str()
raise TypeError( raise TypeError(
"Each shape dimension to Alloc must be a scalar, ", "Each shape dimension to Alloc must be a scalar, ",
'but dimension %s have %d dimensions for apply node: %s' % 'but dimension %s have %d dimensions for apply node: %s' %
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论