From abbc507a81771e01dd89670eced6585f789a2862 Mon Sep 17 00:00:00 2001 From: TeslaZhao Date: Thu, 19 Nov 2020 14:37:19 +0800 Subject: [PATCH] Fix two english api documents, transpose and strided_slice (#28687) * Fix two english api documents, transpose and strided_slice * delete nouse comments --- python/paddle/fluid/layers/nn.py | 8 ++------ python/paddle/tensor/manipulation.py | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 2feca60430d..cafb965d406 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -5448,22 +5448,18 @@ def ctc_greedy_decoder(input, def transpose(x, perm, name=None): """ - :alias_main: paddle.transpose - :alias: paddle.transpose,paddle.tensor.transpose,paddle.tensor.linalg.transpose,paddle.tensor.manipulation.transpose - :old_api: paddle.fluid.layers.transpose - Permute the data dimensions of `input` according to `perm`. The `i`-th dimension of the returned tensor will correspond to the perm[i]-th dimension of `input`. Args: - x (Variable): The input Tensor. It is a N-D Tensor of data types float32, float64, int32. + x (Tensor): The input Tensor. It is a N-D Tensor of data types float32, float64, int32. perm (list|tuple): Permute the input according to the data of perm. name (str): The name of this layer. It is optional. Returns: - Variable: A transposed n-D Tensor, with data type being float32, float64, int32, int64. + Tensor: A transposed n-D Tensor, with data type being float32, float64, int32, int64. For Example: diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index a0e5e681c76..d8b8dab5252 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -1500,6 +1500,7 @@ def strided_slice(x, axes, starts, ends, strides, name=None): strides = [1, 3] Then: result = [ [2], ] + Args: x (Tensor): An N-D ``Tensor``. The data type is ``float32``, ``float64``, ``int32`` or ``int64``. axes (list|tuple): The data type is ``int32`` . Axes that `starts` and `ends` apply to. @@ -1531,7 +1532,7 @@ def strided_slice(x, axes, starts, ends, strides, name=None): # sliced_1 is x[:, 1:3:1, 0:2:1, 2:4:1]. # example 2: # attr starts is a list which contain tensor Tensor. - minus_3 = paddle.fill_constant([1], "int32", -3) + minus_3 = paddle.full(shape=[1], fill_value=-3, dtype='int32') sliced_2 = paddle.strided_slice(x, axes=axes, starts=[minus_3, 0, 2], ends=ends, strides=strides_2) # sliced_2 is x[:, 1:3:1, 0:2:1, 2:4:2]. """ -- GitLab