提交 df02fe22 authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #5299 from fvisin/missing_input_idx

Improve MissingInput message
...@@ -17,8 +17,8 @@ from theano import config ...@@ -17,8 +17,8 @@ from theano import config
from six import iteritems, itervalues from six import iteritems, itervalues
from six.moves import StringIO from six.moves import StringIO
from theano.gof.utils import get_variable_trace_string
from theano.misc.ordered_set import OrderedSet from theano.misc.ordered_set import OrderedSet
NullType = None NullType = None
...@@ -387,13 +387,14 @@ class FunctionGraph(utils.object2): ...@@ -387,13 +387,14 @@ class FunctionGraph(utils.object2):
not isinstance(r, graph.Constant) and not isinstance(r, graph.Constant) and
r not in self.inputs): r not in self.inputs):
# Standard error message # Standard error message
raise MissingInputError(( error_msg = ("Input %d of the graph (indices start "
"An input of the graph, used to compute %s, " "from 0), used to compute %s, was not "
"was not provided and not given a value." "provided and not given a value. Use the "
"Use the Theano flag exception_verbosity='high'," "Theano flag exception_verbosity='high', "
"for more information on this error." "for more information on this error."
% str(node)), % (node.inputs.index(r), str(node)))
variable=r) error_msg += get_variable_trace_string(r)
raise MissingInputError(error_msg, variable=r)
for node in new_nodes: for node in new_nodes:
assert node not in self.apply_nodes assert node not in self.apply_nodes
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论