提交 0477d635 authored 作者: abergeron's avatar abergeron 提交者: GitHub

Merge pull request #5163 from nouiz/constant_folding

[ENH] fix opt error/skip and better error printing.
......@@ -794,9 +794,16 @@ class Function(object):
function_name += ' with name "' + self.name + '"'
if hasattr(arg, 'name') and arg.name:
argument_name += ' with name "' + arg.name + '"'
e.args = ("Bad input " + argument_name + " to " +
function_name + " at index %d (0-based)"
% i,) + e.args
where = theano.gof.utils.get_variable_trace_string(
self.maker.inputs[i].variable)
if len(e.args) == 1:
e.args = ("Bad input " + argument_name + " to " +
function_name + " at index %d (0-based). %s"
% (i, where) + e.args[0],)
else:
e.args = ("Bad input " + argument_name + " to " +
function_name + " at index %d (0-based). %s"
% (i, where),) + e.args
raise
s.provided += 1
i += 1
......
......@@ -1277,7 +1277,8 @@ second dimension
Return True if we do not want to compile c code
when doing constant folding of this node.
"""
return node.outputs[0].ndim == 0
# The python code don't support 32 inputs or more.
return node.outputs[0].ndim == 0 and len(node.inputs) < 32
################
......
......@@ -135,9 +135,9 @@ class TensorType(Type):
'this loss, you can: '
'1) explicitly cast your data to %s, or '
'2) set "allow_input_downcast=True" when calling '
'"function".'
% (self, data.dtype, self.dtype))
raise TypeError(err_msg, data)
'"function". Value: "%s"'
% (self, data.dtype, self.dtype, repr(data)))
raise TypeError(err_msg)
elif (allow_downcast is None and
type(data) is float and
self.dtype == theano.config.floatX):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论