Refine doc of data based on requirement. (#22098)

release/1.7
Huihuang Zheng 6 years ago committed by GitHub
parent dd4361568e
commit 1ce6ab9cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,13 +31,23 @@ def data(name, shape, dtype='float32', lod_level=0):
input into the variable. input into the variable.
Note: Note:
`paddle.fluid.layers.data` is deprecated. It will be removed in a future `paddle.fluid.layers.data` is deprecated. It will be removed in a
version. Please use this `paddle.fluid.data`. future version. Please use this `paddle.fluid.data`.
The `paddle.fluid.layers.data` set shape and dtype at compile time but The `paddle.fluid.layers.data` set shape and dtype at compile time but
does NOT check the shape or the dtype of feeded data, this does NOT check the shape or the dtype of feeded data, this
`paddle.fluid.data` checks the shape and the dtype of data feeded by `paddle.fluid.data` checks the shape and the dtype of data feeded by
Executor or ParallelExecutor during run time. Executor or ParallelExecutor during run time.
To feed variable size inputs, users can set -1 on the variable
dimension when using :code:`paddle.fluid.data`, or feed variable size
inputs directly to :code:`paddle.fluid.layers.data` and PaddlePaddle
will fit the size accordingly.
The default :code:`stop_gradient` attribute of the Variable created by
this API is true, which means the gradient won't be passed backward
through the data Varaible. Set :code:`var.stop_gradient = False` If
user would like to pass backward gradient.
Args: Args:
name (str): The name/alias of the variable, see :ref:`api_guide_Name` name (str): The name/alias of the variable, see :ref:`api_guide_Name`

@ -54,11 +54,21 @@ def data(name,
:code:`paddle.fluid.layers.data` is deprecated as it will be removed in :code:`paddle.fluid.layers.data` is deprecated as it will be removed in
a later version. Please use :code:`paddle.fluid.data` . a later version. Please use :code:`paddle.fluid.data` .
The :code:`paddle.fluid.layers.data` set shape and dtype at compile time This :code:`paddle.fluid.layers.data` set shape and dtype at compile
but does NOT check the shape or the dtype of feeded data, this time but does NOT check the shape or the dtype of feeded data, the
:code:`paddle.fluid.data` checks the shape and the dtype of data feeded :code:`paddle.fluid.data` checks the shape and the dtype of data feeded
by Executor or ParallelExecutor during run time. by Executor or ParallelExecutor during run time.
To feed variable size inputs, users can feed variable size inputs
directly to this :code:`paddle.fluid.layers.data` and PaddlePaddle will
fit the size accordingly. Or set -1 on the variable dimension when using
:code:`paddle.fluid.data` .
The default :code:`stop_gradient` attribute of the Variable created by
this API is true, which means the gradient won't be passed backward
through the data Varaible. Set :code:`var.stop_gradient = False` If
user would like to pass backward gradient.
Args: Args:
name(str): The name/alias of the variable, see :ref:`api_guide_Name` name(str): The name/alias of the variable, see :ref:`api_guide_Name`
for more details. for more details.

Loading…
Cancel
Save