From a069e1ca91599c5f58dc8aa8699268f805a46961 Mon Sep 17 00:00:00 2001 From: yaoxuefeng Date: Mon, 30 Nov 2020 20:13:31 +0800 Subject: [PATCH] fix docs (#29097) --- python/paddle/fluid/dygraph/nn.py | 5 ----- python/paddle/tensor/creation.py | 19 ++++--------------- python/paddle/tensor/linalg.py | 3 --- python/paddle/tensor/manipulation.py | 19 +++++-------------- python/paddle/tensor/math.py | 3 --- 5 files changed, 9 insertions(+), 40 deletions(-) diff --git a/python/paddle/fluid/dygraph/nn.py b/python/paddle/fluid/dygraph/nn.py index 64038c78d30..9382f6b8e73 100644 --- a/python/paddle/fluid/dygraph/nn.py +++ b/python/paddle/fluid/dygraph/nn.py @@ -3197,14 +3197,10 @@ class TreeConv(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. For more details, refer to code examples. It implements flatten a contiguous range of dims into a tensor. - Equation: - Parameters: start_axis(int): first dim to flatten (default = 1) stop_axis(int): last dim to flatten (default = -1). @@ -3218,7 +3214,6 @@ class Flatten(layers.Layer): import paddle import numpy as np - paddle.disable_static() inp_np = np.ones([5, 2, 3, 4]).astype('float32') inp_np = paddle.to_tensor(inp_np) diff --git a/python/paddle/tensor/creation.py b/python/paddle/tensor/creation.py index 32e86c96b4e..7e93ee01fa9 100644 --- a/python/paddle/tensor/creation.py +++ b/python/paddle/tensor/creation.py @@ -610,16 +610,13 @@ def _tril_triu_op(helper): def tril(x, diagonal=0, name=None): 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 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 on and below the diagonal. 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``. diagonal (int, optional): The diagonal to consider, default value is 0. If :attr:`diagonal` = 0, all elements on and below the main diagonal are @@ -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`. 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. Raises: @@ -650,7 +647,6 @@ def tril(x, diagonal=0, name=None): # [ 5, 6, 7, 8], # [ 9, 10, 11, 12]]) - paddle.disable_static() x = paddle.to_tensor(data) @@ -681,16 +677,13 @@ def tril(x, diagonal=0, name=None): def triu(x, diagonal=0, name=None): 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 :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 above the diagonal. 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``. diagonal (int, optional): The diagonal to consider, default value is 0. If :attr:`diagonal` = 0, all elements on and above the main diagonal are @@ -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`. 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. Raises: @@ -721,7 +714,6 @@ def triu(x, diagonal=0, name=None): # [ 5, 6, 7, 8], # [ 9, 10, 11, 12]]) - paddle.disable_static() # example 1, default diagonal x = paddle.to_tensor(data) @@ -752,9 +744,6 @@ def triu(x, diagonal=0, name=None): 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 vector, and creates N-dimensional grids. diff --git a/python/paddle/tensor/linalg.py b/python/paddle/tensor/linalg.py index d8d625c4a5c..c6af97ffcac 100644 --- a/python/paddle/tensor/linalg.py +++ b/python/paddle/tensor/linalg.py @@ -792,9 +792,6 @@ def cholesky(x, upper=False, 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. Both of the two input tensors must be three-dementional and share the same batch size. diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index 15a009ad899..9b692408696 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -116,21 +116,17 @@ def concat(x, axis=0, 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. 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. 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. For more information, please refer to :ref:`api_guide_Name` . 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: .. code-block:: python @@ -138,8 +134,6 @@ def flip(x, axis, name=None): import paddle import numpy as np - paddle.disable_static() - image_shape=(3, 2, 2) x = np.arange(image_shape[0] * image_shape[1] * image_shape[2]).reshape(image_shape) x = x.astype('float32') @@ -275,16 +269,13 @@ def flatten(x, start_axis=0, stop_axis=-1, 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 beyond the last position are re-introduced at the first according to 'shifts'. If a axis is not specified, the tensor will be flattened before rolling and then restored to the original shape. 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 of the `x` tensor are shifted. axis (int|list|tuple|None): axis(axes) along which to roll. @@ -300,12 +291,12 @@ def roll(x, shifts, axis=None, name=None): [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]) out_z1 = paddle.roll(x, shifts=1) - print(out_z1.numpy()) + print(out_z1) #[[9. 1. 2.] # [3. 4. 5.] # [6. 7. 8.]] out_z2 = paddle.roll(x, shifts=1, axis=0) - print(out_z2.numpy()) + print(out_z2) #[[7. 8. 9.] # [1. 2. 3.] # [4. 5. 6.]] diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index 9f84c0b2b5c..cdb7561dba2 100755 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -953,9 +953,6 @@ def mm(input, mat2, 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** This operator is used to perform matrix multiplication for input $x$ and $y$. -- GitLab