未验证 提交 866c1ea6 编写于 作者: P parap1uie-s 提交者: GitHub

fix reshape when is a number (#35016)

上级 ed9a14e4
......@@ -6176,6 +6176,10 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=False, name=None):
elif isinstance(shape, Variable):
shape.stop_gradient = True
out, _ = _C_ops.reshape2(x, shape)
else:
raise ValueError(
"shape must be an instance of `list`, `tuple` or `Variable`,"
" got '{}.'".format(type(shape)))
return dygraph_utils._append_activation_in_dygraph(out, act)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册