diff --git a/python/paddle/fluid/data.py b/python/paddle/fluid/data.py index 26f24f029cd32c58302b551dbdf4fa36c221fc10..6376b4f7749755d6ee59433937ee6f0bd3399896 100644 --- a/python/paddle/fluid/data.py +++ b/python/paddle/fluid/data.py @@ -31,13 +31,23 @@ def data(name, shape, dtype='float32', lod_level=0): input into the variable. Note: - `paddle.fluid.layers.data` is deprecated. It will be removed in a future - version. Please use this `paddle.fluid.data`. + `paddle.fluid.layers.data` is deprecated. It will be removed in a + future version. Please use this `paddle.fluid.data`. - 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 - `paddle.fluid.data` checks the shape and the dtype of data feeded by - Executor or ParallelExecutor during run time. + 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 + `paddle.fluid.data` checks the shape and the dtype of data feeded by + 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: name (str): The name/alias of the variable, see :ref:`api_guide_Name` diff --git a/python/paddle/fluid/layers/io.py b/python/paddle/fluid/layers/io.py index 21461ec9f7d5651ef1a6cb4190fac709a0a18eff..ebef136d9421793761eae7d22506baf6f9957d1a 100644 --- a/python/paddle/fluid/layers/io.py +++ b/python/paddle/fluid/layers/io.py @@ -54,11 +54,21 @@ def data(name, :code:`paddle.fluid.layers.data` is deprecated as it will be removed in a later version. Please use :code:`paddle.fluid.data` . - The :code:`paddle.fluid.layers.data` set shape and dtype at compile time - but does NOT check the shape or the dtype of feeded data, this + This :code:`paddle.fluid.layers.data` set shape and dtype at compile + 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 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: name(str): The name/alias of the variable, see :ref:`api_guide_Name` for more details.