未验证 提交 ccac636d 编写于 作者: M mapingshuo 提交者: GitHub

add example for reshape op (#22129)

* add example for reshape op
上级 3d4f2aa6
...@@ -5556,6 +5556,12 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=False, name=None): ...@@ -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) dim = fluid.layers.fill_constant([1], "int32", 5)
reshaped_2 = fluid.layers.reshape(data_2, shape=[dim, 10]) reshaped_2 = fluid.layers.reshape(data_2, shape=[dim, 10])
# the shape of reshaped_2 is [5,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(): if in_dygraph_mode():
#TODO(zhiqiu): open inplace if we can. #TODO(zhiqiu): open inplace if we can.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册