提交 4b876df8 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

added a verbose exception for Alloc.make_node

上级 290805f7
......@@ -21,7 +21,7 @@ import elemwise
from theano import scalar as scal
from theano.gof.python25 import partial, any, all
from theano import compile, printing
from theano.printing import pprint
from theano.printing import pprint, min_informative_str
# We use these exceptions as well.
from theano.scalar import ComplexError, IntegerDivisionError
......@@ -2492,9 +2492,14 @@ class Alloc(gof.Op):
v = as_tensor_variable(value)
sh = [as_tensor_variable(s) for s in shape]
bcast = []
for s in sh:
for i, s in enumerate(sh):
if s.type.dtype[:3] not in ('int', 'uin'):
raise TypeError('Shape arguments must be integers', s)
if config.exception_verbosity == 'high':
raise TypeError('Shape arguments to Alloc must be integers,' + \
'but argument '+str(i)+' is not for apply node: '+\
min_informative_str(s))
else:
raise TypeError('Shape arguments must be integers', s)
# if s is constant 1, then we're broadcastable in that dim
try:
const_shp = get_constant_value(s)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论