未验证 提交 1ce6ab9c 编写于 作者: H Huihuang Zheng 提交者: GitHub

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

上级 dd436156
...@@ -31,14 +31,24 @@ def data(name, shape, dtype='float32', lod_level=0): ...@@ -31,14 +31,24 @@ 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`
for more details. for more details.
......
...@@ -54,11 +54,21 @@ def data(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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册