From ac889b9343962c9d184e59f445ff67f5ffff35f3 Mon Sep 17 00:00:00 2001 From: yuchen202 <103028470+yuchen202@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:05:09 +0800 Subject: [PATCH] [Docathon] Fix add API Docs (#57434) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 0918API * Apply suggestions from code review Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com> * 0923修改 --------- Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com> --- python/paddle/nn/layer/conv.py | 5 ++++- python/paddle/static/input.py | 1 + python/paddle/tensor/manipulation.py | 6 +----- python/paddle/tensor/math.py | 7 +------ python/paddle/tensor/random.py | 2 +- python/paddle/vision/models/resnet.py | 2 +- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/python/paddle/nn/layer/conv.py b/python/paddle/nn/layer/conv.py index e0ab183f51bcb3..5b6d295458cfaa 100644 --- a/python/paddle/nn/layer/conv.py +++ b/python/paddle/nn/layer/conv.py @@ -759,7 +759,10 @@ class Conv2DTranspose(_ConvNd): * :math:`\ast`: Convolution operation. * :math:`b`: Bias value, a 1-D ``Tensor`` with shape [M]. * :math:`\sigma`: Activation function. - * :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be different. + * :math:`Out`: Output value, a 4-D ``Tensor`` with NCHW or NHWC format, the shape of :math:`Out` and :math:`X` may be different. + + Note: + If output_size is None, :math:`H_{out}` = :math:`H^\prime_{out}` , :math:`W_{out}` = :math:`W^\prime_{out}`. Otherwise, the specified output_size_height (the height of the output feature layer) :math:`H_{out}` should be between :math:`H^\prime_{out}` and :math:`H^\prime_{out} + strides[0]` (excluding :math:`H^\prime_{out} + strides[0]` ). Parameters: in_channels(int): The number of channels in the input image. diff --git a/python/paddle/static/input.py b/python/paddle/static/input.py index 412defb7d6ea21..518fc8d6519cd2 100644 --- a/python/paddle/static/input.py +++ b/python/paddle/static/input.py @@ -180,6 +180,7 @@ class InputSpec: uint8. Default: float32. name (str): The name/alias of the variable, see :ref:`api_guide_Name` for more details. + stop_gradient (bool, optional): A boolean that mentions whether gradient should flow. Default is False, means don't stop calculate gradients. Examples: .. code-block:: python diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index 46849cbde953d6..db54587658137a 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -2896,11 +2896,7 @@ def scatter(x, index, updates, overwrite=True, name=None): x (Tensor): The input N-D Tensor with ndim>=1. Data type can be float32, float64. index (Tensor): The index is a 1-D or 0-D Tensor. Data type can be int32, int64. The length of index cannot exceed updates's length, and the value in index cannot exceed input's length. updates (Tensor): Update input with updates parameter based on index. When the index is a 1-D tensor, the updates shape should be the same as input, and dim value with dim > 1 should be the same as input. When the index is a 0-D tensor, the updates should be a (N-1)-D tensor, the ith dim of the updates should be queal with the (i+1)th dim of the input. - overwrite (bool, optional): The mode that updating the output when there are same indices. - - If True, use the overwrite mode to update the output of the same index, - if False, use the accumulate mode to update the output of the same index. Default value is True. - + overwrite (bool, optional): The mode that updating the output when there are same indices.If True, use the overwrite mode to update the output of the same index,if False, use the accumulate mode to update the output of the same index. Default value is True. 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: diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index fd11afc85935c0..9a4bb3cc9a4d29 100644 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -643,16 +643,11 @@ def add(x, y, name=None): $X$ the tensor of any dimension. $Y$ the tensor whose dimensions must be less than or equal to the dimensions of $X$. - There are two cases for this operator: + This operator is used in the following cases: 1. The shape of $Y$ is the same with $X$. 2. The shape of $Y$ is a continuous subsequence of $X$. - For case 2: - - 1. Broadcast $Y$ to match the shape of $X$, where axis is the start dimension index for broadcasting $Y$ onto $X$. - 2. If $axis$ is -1 (default), $axis$=rank($X$)-rank($Y$). - 3. The trailing dimensions of size 1 for $Y$ will be ignored for the consideration of subsequence, such as shape($Y$) = (2, 1) => (2). For example: diff --git a/python/paddle/tensor/random.py b/python/paddle/tensor/random.py index 93334588440919..e03ab557f42534 100644 --- a/python/paddle/tensor/random.py +++ b/python/paddle/tensor/random.py @@ -1281,7 +1281,7 @@ def rand(shape, dtype=None, name=None): If ``shape`` is an Tensor, it should be an 1-D Tensor which represents a list. dtype (str|np.dtype, optional): The data type of the output Tensor. Supported data types: float32, float64. - Default is None, use global default dtype (see ``get_default_dtype`` + Default is None, use global default dtype (see :ref:`get_default_dtype` for details). name (str, optional): The default value is None. Normally there is no need for user to set this property. For more information, please diff --git a/python/paddle/vision/models/resnet.py b/python/paddle/vision/models/resnet.py index d91cd66f04f5dd..cb270154dd8492 100644 --- a/python/paddle/vision/models/resnet.py +++ b/python/paddle/vision/models/resnet.py @@ -438,7 +438,7 @@ def resnet50(pretrained=False, **kwargs): Args: pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained on ImageNet. Default: False. - **kwargs (optional): Additional keyword arguments. For details, please refer to :ref:`ResNet `. + **kwargs (optional): Additional keyword arguments. For details, please refer to :ref:`ResNet `. Returns: :ref:`api_paddle_nn_Layer`. An instance of ResNet 50-layer model.