未验证 提交 abbc507a 编写于 作者: T TeslaZhao 提交者: GitHub

Fix two english api documents, transpose and strided_slice (#28687)

* Fix two english api documents, transpose and strided_slice

* delete nouse comments
上级 5562d809
...@@ -5448,22 +5448,18 @@ def ctc_greedy_decoder(input, ...@@ -5448,22 +5448,18 @@ def ctc_greedy_decoder(input,
def transpose(x, perm, name=None): 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`. Permute the data dimensions of `input` according to `perm`.
The `i`-th dimension of the returned tensor will correspond to the The `i`-th dimension of the returned tensor will correspond to the
perm[i]-th dimension of `input`. perm[i]-th dimension of `input`.
Args: 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. perm (list|tuple): Permute the input according to the data of perm.
name (str): The name of this layer. It is optional. name (str): The name of this layer. It is optional.
Returns: 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: For Example:
......
...@@ -1500,6 +1500,7 @@ def strided_slice(x, axes, starts, ends, strides, name=None): ...@@ -1500,6 +1500,7 @@ def strided_slice(x, axes, starts, ends, strides, name=None):
strides = [1, 3] strides = [1, 3]
Then: Then:
result = [ [2], ] result = [ [2], ]
Args: Args:
x (Tensor): An N-D ``Tensor``. The data type is ``float32``, ``float64``, ``int32`` or ``int64``. 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. 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): ...@@ -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]. # sliced_1 is x[:, 1:3:1, 0:2:1, 2:4:1].
# example 2: # example 2:
# attr starts is a list which contain tensor Tensor. # 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 = 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]. # sliced_2 is x[:, 1:3:1, 0:2:1, 2:4:2].
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册