From ccac636d5e275f9b02377de1bda3790ae43bfe07 Mon Sep 17 00:00:00 2001 From: mapingshuo Date: Wed, 8 Jan 2020 16:09:02 +0800 Subject: [PATCH] add example for reshape op (#22129) * add example for reshape op --- python/paddle/fluid/layers/nn.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 4b34c365aa4..a536c0b8394 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -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. -- GitLab