提交 8a237007 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Better error message if the length of the shape cannot be determined.

上级 faa77c77
......@@ -6483,7 +6483,14 @@ class Reshape(Op):
def reshape(x, newshape, ndim=None, name=None):
if ndim is None:
try:
ndim = get_vector_length(newshape)
except ValueError:
raise ValueError("The length of the provided shape (%s) cannot "
"be automatically determined, so Theano is not able "
"to know what the number of dimensions of the reshaped "
"variable will be. You can provide the 'ndim' keyword "
"argument to 'reshape' to avoid this problem." % newshape)
op = Reshape(ndim, name)
rval = op(x, newshape)
return rval
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论