提交 3d2f3f7b authored 作者: Frederic's avatar Frederic

Better error messase in reshape.

上级 369c9249
...@@ -4480,6 +4480,11 @@ class Reshape(Op): ...@@ -4480,6 +4480,11 @@ class Reshape(Op):
def reshape(x, newshape, ndim=None, name=None): def reshape(x, newshape, ndim=None, name=None):
if ndim is None: if ndim is None:
newshape = as_tensor_variable(newshape)
if newshape.ndim != 1:
raise TypeError(
"New shape in reshape must be a vector or a list/tuple of"
" scalar. Got %s after conversion to a vector." % newshape)
try: try:
ndim = get_vector_length(newshape) ndim = get_vector_length(newshape)
except ValueError: except ValueError:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论