提交 b5aeafc9 authored 作者: Frederic's avatar Frederic 提交者: Arnaud Bergeron

Don't make opt return errors with bad user graph. The run time error will be better.

上级 b08d5cb7
...@@ -1508,7 +1508,11 @@ def local_subtensor_make_vector(node): ...@@ -1508,7 +1508,11 @@ def local_subtensor_make_vector(node):
# Python 2.4 wants to index only with Python integers # Python 2.4 wants to index only with Python integers
v = int(v) v = int(v)
# We don't need to copy over any stack traces here # We don't need to copy over any stack traces here
return [x.owner.inputs[v]] try:
ret = [x.owner.inputs[v]]
except IndexError:
raise NotScalarConstantError("Bad user graph!")
return ret
except NotScalarConstantError: except NotScalarConstantError:
pass pass
elif idx.ndim == 1 and isinstance(idx, T.Constant): elif idx.ndim == 1 and isinstance(idx, T.Constant):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论