diff --git a/doc/fluid/api/layers.rst b/doc/fluid/api/layers.rst index ae35d8c53476b34cb18331364267dd7c8b94dd64..22e6fb13d7320986a60bc1ef5530187e0970c767 100644 --- a/doc/fluid/api/layers.rst +++ b/doc/fluid/api/layers.rst @@ -494,6 +494,12 @@ reshape .. autofunction:: paddle.fluid.layers.reshape :noindex: +pad +--- + +.. autofunction:: paddle.fluid.layers.pad + :noindex: + scale ----- diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index f96bc6911ffe0efc07be83b262909be213ced40d..3d13133bf25aa3f538f6f574bd2ae682e1bc7e39 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -3380,6 +3380,7 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=True, name=None): Examples: .. code-block:: python + data = fluid.layers.data( name='data', shape=[2, 4, 6], dtype='float32') reshaped = fluid.layers.reshape( @@ -3585,12 +3586,13 @@ def lrn(input, n=5, k=1.0, alpha=1e-4, beta=0.75, name=None): def pad(x, paddings, pad_value=0., name=None): """ - Pads a tensor with a constant value given by :attr:pad_value, and the - padded width is specified by :attr:paddings. + Pads a tensor with a constant value given by :attr:`pad_value`, and the + padded width is specified by :attr:`paddings`. - Specifically, the number of values padded before each dimension - :attr:i is indicated by :attr:paddings[i], and the number of values padded - after each dimension :attr:i is indicated by :attr:paddings[i+1]. + Specifically, the number of values padded before the contents of :attr:`x` + in dimension :attr:`i` is indicated by :attr:`paddings[i]`, and the number + of values padded after the contents of :attr:`x` in dimension :attr:`i` is + indicated by :attr:`paddings[i+1]`. See below for an example. @@ -3624,6 +3626,7 @@ def pad(x, paddings, pad_value=0., name=None): Examples: .. code-block:: python + # x is a rank 2 tensor variable. out = fluid.layers.pad( x=x, paddings=[0, 1, 1, 2], pad_value=0.)