Skip to content

Commit 866c1ea

Browse files
authored
fix reshape when is a number (#35016)
1 parent ed9a14e commit 866c1ea

File tree

1 file changed

+4
-0
lines changed
  • python/paddle/fluid/layers

1 file changed

+4
-0
lines changed

python/paddle/fluid/layers/nn.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6176,6 +6176,10 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=False, name=None):
61766176
elif isinstance(shape, Variable):
61776177
shape.stop_gradient = True
61786178
out, _ = _C_ops.reshape2(x, shape)
6179+
else:
6180+
raise ValueError(
6181+
"shape must be an instance of `list`, `tuple` or `Variable`,"
6182+
" got '{}.'".format(type(shape)))
61796183

61806184
return dygraph_utils._append_activation_in_dygraph(out, act)
61816185

0 commit comments

Comments
 (0)