未验证 提交 a069e1ca 编写于 作者: Y yaoxuefeng 提交者: GitHub

fix docs (#29097)

上级 786e69e9
...@@ -3197,14 +3197,10 @@ class TreeConv(layers.Layer): ...@@ -3197,14 +3197,10 @@ class TreeConv(layers.Layer):
class Flatten(layers.Layer): class Flatten(layers.Layer):
""" """
:alias_main: paddle.nn.Flatten
:alias: paddle.nn.Flatten,paddle.nn.layer.Flatten,paddle.nn.layer.common.Flatten
This interface is used to construct a callable object of the ``FLatten`` class. This interface is used to construct a callable object of the ``FLatten`` class.
For more details, refer to code examples. For more details, refer to code examples.
It implements flatten a contiguous range of dims into a tensor. It implements flatten a contiguous range of dims into a tensor.
Equation:
Parameters: Parameters:
start_axis(int): first dim to flatten (default = 1) start_axis(int): first dim to flatten (default = 1)
stop_axis(int): last dim to flatten (default = -1). stop_axis(int): last dim to flatten (default = -1).
...@@ -3218,7 +3214,6 @@ class Flatten(layers.Layer): ...@@ -3218,7 +3214,6 @@ class Flatten(layers.Layer):
import paddle import paddle
import numpy as np import numpy as np
paddle.disable_static()
inp_np = np.ones([5, 2, 3, 4]).astype('float32') inp_np = np.ones([5, 2, 3, 4]).astype('float32')
inp_np = paddle.to_tensor(inp_np) inp_np = paddle.to_tensor(inp_np)
......
...@@ -610,16 +610,13 @@ def _tril_triu_op(helper): ...@@ -610,16 +610,13 @@ def _tril_triu_op(helper):
def tril(x, diagonal=0, name=None): def tril(x, diagonal=0, name=None):
r""" r"""
:alias_main: paddle.tril
:alias: paddle.tril,paddle.tensor.tril,paddle.tensor.creation.tril
This op returns the lower triangular part of a matrix (2-D tensor) or batch This op returns the lower triangular part of a matrix (2-D tensor) or batch
of matrices :attr:`x`, the other elements of the result tensor are set of matrices :attr:`x`, the other elements of the result tensor are set
to 0. The lower triangular part of the matrix is defined as the elements to 0. The lower triangular part of the matrix is defined as the elements
on and below the diagonal. on and below the diagonal.
Args: Args:
x (Variable): The input variable x which is a Tensor. x (Tensor): The input x which is a Tensor.
Support data types: ``float64``, ``float32``, ``int32``, ``int64``. Support data types: ``float64``, ``float32``, ``int32``, ``int64``.
diagonal (int, optional): The diagonal to consider, default value is 0. diagonal (int, optional): The diagonal to consider, default value is 0.
If :attr:`diagonal` = 0, all elements on and below the main diagonal are If :attr:`diagonal` = 0, all elements on and below the main diagonal are
...@@ -632,7 +629,7 @@ def tril(x, diagonal=0, name=None): ...@@ -632,7 +629,7 @@ def tril(x, diagonal=0, name=None):
user to set this property. For more information, please refer to :ref:`api_guide_Name`. user to set this property. For more information, please refer to :ref:`api_guide_Name`.
Returns: Returns:
Variable: Tensor, results of lower triangular operation by the specified diagonal of input tensor x, Tensor: Results of lower triangular operation by the specified diagonal of input tensor x,
it's data type is the same as x's Tensor. it's data type is the same as x's Tensor.
Raises: Raises:
...@@ -650,7 +647,6 @@ def tril(x, diagonal=0, name=None): ...@@ -650,7 +647,6 @@ def tril(x, diagonal=0, name=None):
# [ 5, 6, 7, 8], # [ 5, 6, 7, 8],
# [ 9, 10, 11, 12]]) # [ 9, 10, 11, 12]])
paddle.disable_static()
x = paddle.to_tensor(data) x = paddle.to_tensor(data)
...@@ -681,16 +677,13 @@ def tril(x, diagonal=0, name=None): ...@@ -681,16 +677,13 @@ def tril(x, diagonal=0, name=None):
def triu(x, diagonal=0, name=None): def triu(x, diagonal=0, name=None):
r""" r"""
:alias_main: paddle.triu
:alias: paddle.triu,paddle.tensor.triu,paddle.tensor.creation.triu
This op returns the upper triangular part of a matrix (2-D tensor) or batch of matrices This op returns the upper triangular part of a matrix (2-D tensor) or batch of matrices
:attr:`x`, the other elements of the result tensor are set to 0. :attr:`x`, the other elements of the result tensor are set to 0.
The upper triangular part of the matrix is defined as the elements on and The upper triangular part of the matrix is defined as the elements on and
above the diagonal. above the diagonal.
Args: Args:
x (Variable): The input variable x which is a Tensor. x (Tensor): The input x which is a Tensor.
Support data types: ``float64``, ``float32``, ``int32``, ``int64``. Support data types: ``float64``, ``float32``, ``int32``, ``int64``.
diagonal (int, optional): The diagonal to consider, default value is 0. diagonal (int, optional): The diagonal to consider, default value is 0.
If :attr:`diagonal` = 0, all elements on and above the main diagonal are If :attr:`diagonal` = 0, all elements on and above the main diagonal are
...@@ -703,7 +696,7 @@ def triu(x, diagonal=0, name=None): ...@@ -703,7 +696,7 @@ def triu(x, diagonal=0, name=None):
user to set this property. For more information, please refer to :ref:`api_guide_Name`. user to set this property. For more information, please refer to :ref:`api_guide_Name`.
Returns: Returns:
Variable: Tensor, results of upper triangular operation by the specified diagonal of input tensor x, Tensor: Results of upper triangular operation by the specified diagonal of input tensor x,
it's data type is the same as x's Tensor. it's data type is the same as x's Tensor.
Raises: Raises:
...@@ -721,7 +714,6 @@ def triu(x, diagonal=0, name=None): ...@@ -721,7 +714,6 @@ def triu(x, diagonal=0, name=None):
# [ 5, 6, 7, 8], # [ 5, 6, 7, 8],
# [ 9, 10, 11, 12]]) # [ 9, 10, 11, 12]])
paddle.disable_static()
# example 1, default diagonal # example 1, default diagonal
x = paddle.to_tensor(data) x = paddle.to_tensor(data)
...@@ -752,9 +744,6 @@ def triu(x, diagonal=0, name=None): ...@@ -752,9 +744,6 @@ def triu(x, diagonal=0, name=None):
def meshgrid(*args, **kwargs): def meshgrid(*args, **kwargs):
""" """
:alias_main: paddle.meshgrid
:alias: paddle.meshgrid,paddle.tensor.meshgrid,paddle.tensor.creation.meshgrid
This op takes a list of N tensors as input *args, each of which is 1-dimensional This op takes a list of N tensors as input *args, each of which is 1-dimensional
vector, and creates N-dimensional grids. vector, and creates N-dimensional grids.
......
...@@ -792,9 +792,6 @@ def cholesky(x, upper=False, name=None): ...@@ -792,9 +792,6 @@ def cholesky(x, upper=False, name=None):
def bmm(x, y, name=None): def bmm(x, y, name=None):
""" """
:alias_main: paddle.bmm
:alias: paddle.bmm,paddle.tensor.bmm,paddle.tensor.linalg.bmm
Applies batched matrix multiplication to two tensors. Applies batched matrix multiplication to two tensors.
Both of the two input tensors must be three-dementional and share the same batch size. Both of the two input tensors must be three-dementional and share the same batch size.
......
...@@ -116,21 +116,17 @@ def concat(x, axis=0, name=None): ...@@ -116,21 +116,17 @@ def concat(x, axis=0, name=None):
def flip(x, axis, name=None): def flip(x, axis, name=None):
""" """
:alias_main: paddle.flip
:alias: paddle.flip,paddle.tensor.flip,paddle.tensor.manipulation.flip
Reverse the order of a n-D tensor along given axis in axis. Reverse the order of a n-D tensor along given axis in axis.
Args: Args:
x (Variable): A Tensor(or LoDTensor) with shape :math:`[N_1, N_2,..., N_k]` . The data type of the input Tensor x x (Tensor): A Tensor(or LoDTensor) with shape :math:`[N_1, N_2,..., N_k]` . The data type of the input Tensor x
should be float32, float64, int32, int64, bool. should be float32, float64, int32, int64, bool.
axis (list): The axis(axes) to flip on. Negative indices for indexing from the end are accepted. axis (list): The axis(axes) to flip on. Negative indices for indexing from the end are accepted.
name (str, optional): The default value is None. Normally there is no need for user to set this property. name (str, optional): The default value is None. Normally there is no need for user to set this property.
For more information, please refer to :ref:`api_guide_Name` . For more information, please refer to :ref:`api_guide_Name` .
Returns: Returns:
Variable: Tensor or LoDTensor calculated by flip layer. The data type is same with input x. Tensor: Tensor or LoDTensor calculated by flip layer. The data type is same with input x.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -138,8 +134,6 @@ def flip(x, axis, name=None): ...@@ -138,8 +134,6 @@ def flip(x, axis, name=None):
import paddle import paddle
import numpy as np import numpy as np
paddle.disable_static()
image_shape=(3, 2, 2) image_shape=(3, 2, 2)
x = np.arange(image_shape[0] * image_shape[1] * image_shape[2]).reshape(image_shape) x = np.arange(image_shape[0] * image_shape[1] * image_shape[2]).reshape(image_shape)
x = x.astype('float32') x = x.astype('float32')
...@@ -275,16 +269,13 @@ def flatten(x, start_axis=0, stop_axis=-1, name=None): ...@@ -275,16 +269,13 @@ def flatten(x, start_axis=0, stop_axis=-1, name=None):
def roll(x, shifts, axis=None, name=None): def roll(x, shifts, axis=None, name=None):
""" """
:alias_main: paddle.roll
:alias: paddle.roll,paddle.tensor.roll,paddle.tensor.manipulation.roll
Roll the `x` tensor along the given axis(axes). With specific 'shifts', Elements that Roll the `x` tensor along the given axis(axes). With specific 'shifts', Elements that
roll beyond the last position are re-introduced at the first according to 'shifts'. roll beyond the last position are re-introduced at the first according to 'shifts'.
If a axis is not specified, If a axis is not specified,
the tensor will be flattened before rolling and then restored to the original shape. the tensor will be flattened before rolling and then restored to the original shape.
Args: Args:
x (Tensor): The x tensor variable as input. x (Tensor): The x tensor as input.
shifts (int|list|tuple): The number of places by which the elements shifts (int|list|tuple): The number of places by which the elements
of the `x` tensor are shifted. of the `x` tensor are shifted.
axis (int|list|tuple|None): axis(axes) along which to roll. axis (int|list|tuple|None): axis(axes) along which to roll.
...@@ -300,12 +291,12 @@ def roll(x, shifts, axis=None, name=None): ...@@ -300,12 +291,12 @@ def roll(x, shifts, axis=None, name=None):
[4.0, 5.0, 6.0], [4.0, 5.0, 6.0],
[7.0, 8.0, 9.0]]) [7.0, 8.0, 9.0]])
out_z1 = paddle.roll(x, shifts=1) out_z1 = paddle.roll(x, shifts=1)
print(out_z1.numpy()) print(out_z1)
#[[9. 1. 2.] #[[9. 1. 2.]
# [3. 4. 5.] # [3. 4. 5.]
# [6. 7. 8.]] # [6. 7. 8.]]
out_z2 = paddle.roll(x, shifts=1, axis=0) out_z2 = paddle.roll(x, shifts=1, axis=0)
print(out_z2.numpy()) print(out_z2)
#[[7. 8. 9.] #[[7. 8. 9.]
# [1. 2. 3.] # [1. 2. 3.]
# [4. 5. 6.]] # [4. 5. 6.]]
......
...@@ -953,9 +953,6 @@ def mm(input, mat2, name=None): ...@@ -953,9 +953,6 @@ def mm(input, mat2, name=None):
def addmm(input, x, y, beta=1.0, alpha=1.0, name=None): def addmm(input, x, y, beta=1.0, alpha=1.0, name=None):
""" """
:alias_main: paddle.addmm
:alias: paddle.addmm,paddle.tensor.addmm,paddle.tensor.math.addmm
**addmm** **addmm**
This operator is used to perform matrix multiplication for input $x$ and $y$. This operator is used to perform matrix multiplication for input $x$ and $y$.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册