未验证 提交 ba422913 编写于 作者: I Infinity_lee 提交者: GitHub

fix english docs typo errors (#48990)

* fix english docs typo errors

* fix english docs typo errors
上级 12473236
......@@ -1445,35 +1445,35 @@ def alpha_dropout(x, p=0.5, training=True, name=None):
return x
def pad(x, pad, mode='constant', value=0, data_format="NCHW", name=None):
def pad(x, pad, mode='constant', value=0.0, data_format="NCHW", name=None):
"""
Pad tensor according to 'pad' and 'mode'.
If mode is 'constant' and length of pad is twice as length of x dimension,
Pad tensor according to ``'pad'`` and ``'mode'``.
If mode is ``'constant'`` and length of pad is twice as length of x dimension,
then the padding will be started from the first dimension and moved back onto x
according to 'pad' and 'value'.
If mode is 'reflect', pad[0] and pad[1] must be no greater
according to ``'pad'`` and ``'value'``.
If mode is ``'reflect'``, pad[0] and pad[1] must be no greater
than width-1. The height and depth dimension has the same condition.
Parameters:
x (Tensor): The input tensor with data type float32/double/int32/int64_t.
pad (Tensor|list[int]|tuple[int]): The padding size with data type int.
If mode is 'constant' and length of pad is twice as length of x dimension, then x will
If mode is ``'constant'`` and length of pad is twice as length of x dimension, then x will
be padded from the first dimension to the last dimension.
Else: 1. If input dimension is 3, then the pad has the form (pad_left,
pad_right). 2. If the input dimension is 4, then the pad has the form (pad_left, pad_right,
pad_top, pad_bottom). 3. If the input dimension is 5, then the pad has the form
(pad_left, pad_right, pad_top, pad_bottom, pad_front, pad_back).
mode (str, optional): Four modes: 'constant' (default), 'reflect', 'replicate', 'circular'. Default is 'constant'
mode (str, optional): Four modes: ``'constant'`` (default), ``'reflect'``, ``'replicate'``, ``'circular'``. Default is ``'constant'``.
- 'constant' mode, uses a constant value to pad the input tensor.
- 'reflect' mode, uses reflection of the input boundaries to pad the input tensor.
- 'replicate' mode, uses input boundaries to pad the input tensor.
- 'circular' mode, uses circular input to pad the input tensor.
value (float, optional): The value to fill the padded areas in 'constant' mode . Default is :math:`0.0`
data_format (str, optional): An string from: "NCL", "NLC", NHWC", "NCHW", "NCDHW", "NDHWC". Specify the data format of
the input data. Default is "NCHW",
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
value (float, optional): The value to fill the padded areas in 'constant' mode . Default is :math:`0.0`.
data_format (str, optional): An string from: ``'NCL'``, ``'NLC'``, ``'NHWC'``, ``'NCHW'``, ``'NCDHW'``, ``'NDHWC'``. Specify the data format of
the input data. Default: ``'NCHW'``.
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: ``'None'``.
Returns:
Tensor, a Tensor padded according to pad and mode and data type is same as input.
......
......@@ -1419,7 +1419,8 @@ def nll_loss(
):
"""
This api returns negative log likelihood.
See more detail in :ref:`api_nn_loss_NLLLoss` .
See more detail in :ref:`NLLLoss <api_paddle_nn_NLLLoss>` .
Parameters:
input (Tensor): Input tensor, the shape is :math:`[N, C]`, `C` is the number of classes.
......
......@@ -348,14 +348,14 @@ def grid_sample(
def pixel_shuffle(x, upscale_factor, data_format="NCHW", name=None):
"""
This API implements pixel shuffle operation.
See more details in :ref:`api_nn_vision_PixelShuffle` .
See more details in :ref:`PixelSuffle <api_paddle_nn_PixelSuffle>` .
Parameters:
x(Tensor): 4-D tensor, the data type should be float32 or float64.
upscale_factor(int): factor to increase spatial resolution.
data_format (str, optional): The data format of the input and output data. An optional string from: "NCHW", "NHWC". The default is "NCHW". When it is "NCHW", the data is stored in the order of: [batch_size, input_channels, input_height, input_width].
name (str, optional): The default value is None. Normally there is no need for user to set this property.
data_format (str, optional): The data format of the input and output data. An optional string from: ``'NCHW'``, ``'NHWC'``. When it is ``'NCHW'``, the data is stored in the order of: [batch_size, input_channels, input_height, input_width]. Default: ``'NCHW'``.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Out(tensor): Reshaped tensor according to the new dimension.
......@@ -402,12 +402,12 @@ def pixel_shuffle(x, upscale_factor, data_format="NCHW", name=None):
def pixel_unshuffle(x, downscale_factor, data_format="NCHW", name=None):
"""
This API implements pixel unshuffle operation.
See more details in :ref:`api_nn_vision_PixelUnshuffle` .
See more details in :ref:`PixelUnSuffle <api_paddle_nn_PixelUnSuffle>` .
Parameters:
x (Tensor): 4-D tensor, the data type should be float32 or float64.
downscale_factor (int): Factor to decrease spatial resolution.
data_format (str, optional): The data format of the input and output data. An optional string of NCHW or NHWC. The default is NCHW. When it is NCHW, the data is stored in the order of [batch_size, input_channels, input_height, input_width].
data_format (str, optional): The data format of the input and output data. An optional string of ``'NCHW'`` or ``'NHWC'``. When it is ``'NCHW'``, the data is stored in the order of [batch_size, input_channels, input_height, input_width]. Default: ``'NCHW'``.
name (str, optional): Name for the operation (optional, default is None). Normally there is no need for user to set this property. For more information, please refer to :ref:`api_guide_Name`.
Returns:
......
......@@ -1012,24 +1012,24 @@ class AlphaDropout(Layer):
class Pad1D(Layer):
"""
This interface is used to construct a callable object of the ``Pad1D`` class.
Pad tensor according to 'pad', 'mode' and 'value'.
If mode is 'reflect', pad[0] and pad[1] must be no greater than width-1.
Pad tensor according to ``pad``, ``mode`` and ``value``.
If mode is ``reflect``, pad[0] and pad[1] must be no greater than width-1.
Parameters:
padding (Tensor|list[int]|int): The padding size with data type int. If is int, use the
padding (Tensor|list[int]|int): The padding size with data type ``'int'``. If is ``'int'``, use the
same padding in both dimensions. Else [len(padding)/2] dimensions
of input will be padded. The pad has the form (pad_left, pad_right).
mode (str, optional): Four modes: 'constant' (default), 'reflect', 'replicate', 'circular'. Default is 'constant'.
mode (str, optional): Four modes: ``'constant'`` (default), ``'reflect'``, ``'replicate'``, ``'circular'``. Default: ``'constant'``.
- 'constant' mode, uses a constant value to pad the input tensor.
- 'reflect' mode, uses reflection of the input boundaries to pad the input tensor.
- 'replicate' mode, uses input boundaries to pad the input tensor.
- 'circular' mode, uses circular input to pad the input tensor.
value (float, optional): The value to fill the padded areas. Default is :math:`0.0`
data_format (str, optional): An string from: "NCL", "NLC". Specify the data format of the input data.
Default is "NCL"
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
value (float, optional): The value to fill the padded areas. Default is :math:`0.0`.
data_format (str, optional): An string from: ``'NCL'``, ``'NLC'``. Specify the data format of the input data.
Default: ``'NCL'``.
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: ``'None'``.
Returns:
None
......@@ -1081,25 +1081,25 @@ class Pad1D(Layer):
class Pad2D(Layer):
"""
This interface is used to construct a callable object of the ``Pad2D`` class.
Pad tensor according to 'pad', 'mode' and 'value'.
If mode is 'reflect', pad[0] and pad[1] must be no greater
Pad tensor according to ``pad``, ``mode`` and ``value``.
If mode is ``'reflect'``, pad[0] and pad[1] must be no greater
than width-1. The height dimension has the same condition.
Parameters:
padding (Tensor|list[int]|int): The padding size with data type int. If is int, use the
padding (Tensor|list[int]|int): The padding size with data type ``'int'``. If is ``'int'``, use the
same padding in all dimensions. Else [len(padding)/2] dimensions of input will be padded.
The pad has the form (pad_left, pad_right, pad_top, pad_bottom).
mode (str, optional): Four modes: 'constant' (default), 'reflect', 'replicate', 'circular'. Default is 'constant'.
mode (str, optional): Four modes: ``'constant'`` (default), ``'reflect'``, ``'replicate'``, ``'circular'``. Default: ``'constant'``.
- 'constant' mode, uses a constant value to pad the input tensor.
- 'reflect' mode, uses reflection of the input boundaries to pad the input tensor.
- 'replicate' mode, uses input boundaries to pad the input tensor.
- 'circular' mode, uses circular input to pad the input tensor.
value (float, optional): The value to fill the padded areas. Default is :math:`0.0`
data_format (str, optional): An string from: "NCHW", "NHWC". Specify the data format of the input data.
Default is "NCHW"。
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
value (float, optional): The value to fill the padded areas. Default is :math:`0.0`.
data_format (str, optional): An string from: ``'NCHW'``, ``'NHWC'``. Specify the data format of the input data.
Default: ``'NCHW'``.
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: ``'None'``.
Returns:
None
......@@ -1223,25 +1223,25 @@ class ZeroPad2D(Layer):
class Pad3D(Layer):
"""
This interface is used to construct a callable object of the ``Pad3D`` class.
Pad tensor according to 'pad', 'mode' and 'value'.
If mode is 'reflect', pad[0] and pad[1] must be no greater
Pad tensor according to ``'pad'``, ``'mode'`` and ``'value'``.
If mode is ``'reflect'``, pad[0] and pad[1] must be no greater
than width-1. The height and depth dimension has the same condition.
Parameters:
padding (Tensor|list[int]|int): The padding size with data type int. If is int, use the
padding (Tensor|list[int]|int): The padding size with data type ``'int'``. If is ``'int'``, use the
same padding in all dimensions. Else [len(padding)/2] dimensions
of input will be padded. The pad has the form (pad_left, pad_right, pad_top, pad_bottom, pad_front, pad_back).
mode (str, optional): Four modes: 'constant' (default), 'reflect', 'replicate', 'circular'. Default is 'constant'.
mode (str, optional): Four modes: ``'constant'`` (default), ``'reflect'``, ``'replicate'``, ``'circular'``. Default: ``'constant'``.
- 'constant' mode, uses a constant value to pad the input tensor.
- 'reflect' mode, uses reflection of the input boundaries to pad the input tensor.
- 'replicate' mode, uses input boundaries to pad the input tensor.
- 'circular' mode, uses circular input to pad the input tensor.
value (float, optional): The value to fill the padded areas. Default is :math:`0.0`
data_format (str, optional): An string from: "NCDHW", "NDHWC". Specify the data format of the input data.
Default is "NCDHW"
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
value (float, optional): The value to fill the padded areas. Default is :math:`0.0`.
data_format (str, optional): An string from: ``'NCDHW'``, ``'NDHWC'``. Specify the data format of the input data.
Default: ``'NCDHW'``
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: ``'None'``.
Returns:
None
......
......@@ -817,12 +817,12 @@ class NLLLoss(Layer):
ignore_index (int, optional): Specifies a target value that is ignored
and does not contribute to the input gradient.
reduction (str, optional): Indicate how to average the loss,
the candicates are ``'none'`` | ``'mean'`` | ``'sum'``.
the candicates are ``'none'`` | ``'mean'`` | ``'sum'``. Default is ``'mean'``.
If `reduction` is ``'mean'``, the reduced mean loss is returned;
if `reduction` is ``'sum'``, the reduced sum loss is returned;
if `reduction` is ``'none'``, no reduction will be apllied.
Default is ``'mean'``.
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default is ``'None'``.
Shape:
- input (Tensor): Input tensor, the shape is :math:`[N, C]`, `C` is the number of classes.
......
......@@ -22,11 +22,9 @@ __all__ = []
class PixelShuffle(Layer):
"""
PixelShuffle Layer
Rearranges elements in a tensor of shape :math:`[N, C, H, W]`
to a tensor of shape :math:`[N, C/upscale_factor^2, H*upscale_factor, W \times upscale_factor]`,
or from shape :math:`[N, H, W, C]` to :math:`[N, H \times upscale_factor, W \times upscale_factor, C/upscale_factor^2]`.
to a tensor of shape :math:`[N, C/upscale_factor^2, H*upscale_factor, W*upscale_factor]`,
or from shape :math:`[N, H, W, C]` to :math:`[N, H*upscale_factor, W*upscale_factor, C/upscale_factor^2]`.
This is useful for implementing efficient sub-pixel convolution
with a stride of 1/upscale_factor.
Please refer to the paper: `Real-Time Single Image and Video Super-Resolution
......@@ -36,12 +34,12 @@ class PixelShuffle(Layer):
Parameters:
upscale_factor(int): factor to increase spatial resolution.
data_format (str, optional): The data format of the input and output data. An optional string from: "NCHW", "NHWC". The default is "NCHW". When it is "NCHW", the data is stored in the order of: [batch_size, input_channels, input_height, input_width].
data_format (str, optional): The data format of the input and output data. An optional string from: `'NCHW'``, ``'NHWC'``. When it is ``'NCHW'``, the data is stored in the order of: [batch_size, input_channels, input_height, input_width]. Default: ``'NCHW'``.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Shape:
- x: 4-D tensor with shape of :math:`(N, C, H, W)` or :math:`(N, H, W, C)`.
- out: 4-D tensor with shape of :math:`(N, C/upscale_factor^2, H \times upscale_factor, W \times upscale_factor)` or :math:`(N, H \times upscale_factor, W \times upscale_factor, C/upscale_factor^2)`.
- out: 4-D tensor with shape of :math:`(N, C/upscale_factor^2, H*upscale_factor, W*upscale_factor)` or :math:`(N, H*upscale_factor, W*upscale_factor, C/upscale_factor^2)`.
Examples:
......@@ -100,7 +98,7 @@ class PixelUnshuffle(Layer):
Parameters:
downscale_factor (int): Factor to decrease spatial resolution.
data_format (str, optional): The data format of the input and output data. An optional string of NCHW or NHWC. The default is NCHW. When it is NCHW, the data is stored in the order of [batch_size, input_channels, input_height, input_width].
data_format (str, optional): The data format of the input and output data. An optional string of ``'NCHW'`` or ``'NHWC'``. When it is ``'NCHW'``, the data is stored in the order of [batch_size, input_channels, input_height, input_width]. Default: ``'NCHW'``.
name (str, optional): Name for the operation (optional, default is None). Normally there is no need for user to set this property. For more information, please refer to :ref:`api_guide_Name`.
Shape:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册