From 5d79530681794239f869cae7519e0cc7e27a275e Mon Sep 17 00:00:00 2001 From: mapingshuo Date: Mon, 28 Sep 2020 10:20:16 +0800 Subject: [PATCH] update example, test=develop --- .../paddle/tensor/manipulation/reshape_cn.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/paddle/api/paddle/tensor/manipulation/reshape_cn.rst b/doc/paddle/api/paddle/tensor/manipulation/reshape_cn.rst index d9baf1c85..869f01f5a 100644 --- a/doc/paddle/api/paddle/tensor/manipulation/reshape_cn.rst +++ b/doc/paddle/api/paddle/tensor/manipulation/reshape_cn.rst @@ -41,16 +41,18 @@ reshape import numpy as np import paddle - data = np.random.random([2, 4, 6]).astype("float32") - x = paddle.to_tensor(data) - positive_four = paddle.fill_constant([1], "int32", 4) - out_1 = paddle.reshape(x, [-1, 0, 3, 2]) - # the shape of out_1 is [2,4,3,2]. - out_2 = paddle.reshape(x, shape=[positive_four, 12]) + x = paddle.rand([2, 4, 6], dtype="float32") + positive_four = paddle.full([1], 4, "int32") + out = paddle.reshape(x, [-1, 0, 3, 2]) + print(out) + # the shape is [2,4,3,2]. + out = paddle.reshape(x, shape=[positive_four, 12]) + print(out) # the shape of out_2 is [4, 12]. shape_tensor = paddle.to_tensor(np.array([8, 6]).astype("int32")) - out_3 = paddle.reshape(x, shape=shape_tensor) - # the shape of out_2 is [8, 6]. + out = paddle.reshape(x, shape=shape_tensor) + print(out) + # the shape is [8, 6]. -- GitLab