Skip to content

Commit

Permalink
fix reshape when is a number (#35016)
Browse files Browse the repository at this point in the history
  • Loading branch information
parap1uie-s authored Aug 19, 2021
1 parent ed9a14e commit 866c1ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/paddle/fluid/layers/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 866c1ea

Please sign in to comment.