diff --git a/python/paddle/nn/clip.py b/python/paddle/nn/clip.py index 54ed08e021a5cfff342854b7def28f97777d0c2a..c3e00894eb4a9f0080032235a4c56d95780d9706 100644 --- a/python/paddle/nn/clip.py +++ b/python/paddle/nn/clip.py @@ -371,7 +371,7 @@ class ClipGradByValue(ClipGradBase): Args: max (float): The maximum value to clip by. min (float, optional): The minimum value to clip by. if not set by user, it will be set to ``-max`` - automatically. In this case, ``max`` must be greater than 0. + automatically. In this case, ``max`` must be greater than :math:`0`. Examples: .. code-block:: python diff --git a/python/paddle/nn/functional/common.py b/python/paddle/nn/functional/common.py index 6758aab997547506a4f662378624723b1675d60a..b957eb369ad8abc55ede2ddf297239a97cdb3c23 100644 --- a/python/paddle/nn/functional/common.py +++ b/python/paddle/nn/functional/common.py @@ -1730,7 +1730,7 @@ def zeropad2d(x, padding, data_format="NCHW", name=None): data_format(str, optional): An string from: "NHWC", "NCHW". Specify the data format of the input data. Default: "NCHW". name(str, optional): The default value is None. Normally there is no need for user - to set this property. + to set this property. For more information, please refer to :ref:`api_guide_Name`. Returns: Tensor, padded with 0 according to pad and data type is same as input. @@ -1739,12 +1739,11 @@ def zeropad2d(x, padding, data_format="NCHW", name=None): .. code-block:: python import paddle - import numpy as np import paddle.nn.functional as F - - x_shape = (1, 1, 2, 3) - x = paddle.arange(np.prod(x_shape), dtype="float32").reshape(x_shape) + 1 + x_shape = paddle.to_tensor([1, 1, 2, 3]) + x = paddle.arange(paddle.prod(x_shape), dtype="float32").reshape(x_shape) + 1 y = F.zeropad2d(x, [1, 2, 1, 1]) + print(y) # [[[[0. 0. 0. 0. 0. 0.] # [0. 1. 2. 3. 0. 0.] # [0. 4. 5. 6. 0. 0.] diff --git a/python/paddle/nn/layer/rnn.py b/python/paddle/nn/layer/rnn.py index 7913ce3603567743e8e41b5e73b56f38c27bfd23..61e731c045a08b93b263b1a2714dd014166cd53a 100644 --- a/python/paddle/nn/layer/rnn.py +++ b/python/paddle/nn/layer/rnn.py @@ -1224,7 +1224,7 @@ class BiRNN(Layer): Parameters: cell_fw (RNNCellBase): A RNNCellBase instance used for forward RNN. cell_bw (RNNCellBase): A RNNCellBase instance used for backward RNN. - time_major (bool): Whether the first dimension of the input means the + time_major (bool, optional): Whether the first dimension of the input means the time steps. Defaults to False. Inputs: