add example for reshape op (#22129)

* add example for reshape op
release/1.7
mapingshuo 5 years ago committed by GitHub
parent 3d4f2aa689
commit ccac636d5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5556,6 +5556,12 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=False, name=None):
dim = fluid.layers.fill_constant([1], "int32", 5)
reshaped_2 = fluid.layers.reshape(data_2, shape=[dim, 10])
# the shape of reshaped_2 is [5,10].
# example 3:
data_3 = fluid.data(
name="data_3", shape=[2,4,6], dtype='float32')
reshaped_3 = fluid.layers.reshape(x=data_3, shape=[6,8])
# the shape of reshaped_3 is [6,8].
"""
if in_dygraph_mode():
#TODO(zhiqiu): open inplace if we can.

Loading…
Cancel
Save