From fa82a0150368dc68520ac9b64eae4697997a619e Mon Sep 17 00:00:00 2001 From: Huihuang Zheng Date: Thu, 10 Oct 2019 09:45:36 +0800 Subject: [PATCH] Modify English doc of fluid.data (#20248) --- paddle/fluid/API.spec | 2 +- python/paddle/fluid/data.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index c78c34c76bb..ec91dd696b5 100755 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -567,7 +567,7 @@ paddle.fluid.contrib.BasicLSTMUnit.sublayers (ArgSpec(args=['self', 'include_sub paddle.fluid.contrib.BasicLSTMUnit.train (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.contrib.basic_lstm (ArgSpec(args=['input', 'init_hidden', 'init_cell', 'hidden_size', 'num_layers', 'sequence_length', 'dropout_prob', 'bidirectional', 'batch_first', 'param_attr', 'bias_attr', 'gate_activation', 'activation', 'forget_bias', 'dtype', 'name'], varargs=None, keywords=None, defaults=(1, None, 0.0, False, True, None, None, None, None, 1.0, 'float32', 'basic_lstm')), ('document', 'fe4d0c3c55a162b8cfe10b05fabb7ce4')) paddle.fluid.contrib.ctr_metric_bundle (ArgSpec(args=['input', 'label'], varargs=None, keywords=None, defaults=None), ('document', 'b68d12366896c41065fc3738393da2aa')) -paddle.fluid.data (ArgSpec(args=['name', 'shape', 'dtype', 'lod_level'], varargs=None, keywords=None, defaults=('float32', 0)), ('document', '28ee6b35836449f44ce53467f0616137')) +paddle.fluid.data (ArgSpec(args=['name', 'shape', 'dtype', 'lod_level'], varargs=None, keywords=None, defaults=('float32', 0)), ('document', 'a44fce9b5c8919bf5937a1cc0fe484ca')) paddle.fluid.dygraph.Layer ('paddle.fluid.dygraph.layers.Layer', ('document', 'a889d5affd734ede273e94d4257163ab')) paddle.fluid.dygraph.Layer.__init__ (ArgSpec(args=['self', 'name_scope', 'dtype'], varargs=None, keywords=None, defaults=(VarType.FP32,)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.dygraph.Layer.add_parameter (ArgSpec(args=['self', 'name', 'parameter'], varargs=None, keywords=None, defaults=None), ('document', 'f35ab374c7d5165c3daf3bd64a5a2ec1')) diff --git a/python/paddle/fluid/data.py b/python/paddle/fluid/data.py index 008765c3f53..26f24f029cd 100644 --- a/python/paddle/fluid/data.py +++ b/python/paddle/fluid/data.py @@ -42,7 +42,9 @@ def data(name, shape, dtype='float32', lod_level=0): Args: name (str): The name/alias of the variable, see :ref:`api_guide_Name` for more details. - shape (list|tuple): List|Tuple of integers declaring the shape. + shape (list|tuple): List|Tuple of integers declaring the shape. You can + set "None" at a dimension to indicate the dimension can be of any + size. For example, it is useful to set changable batch size as "None" dtype (np.dtype|VarType|str, optional): The type of the data. Supported dtype: bool, float16, float32, float64, int8, int16, int32, int64, uint8. Default: float32 @@ -63,10 +65,10 @@ def data(name, shape, dtype='float32', lod_level=0): # User can only feed data of the same shape to x x = fluid.data(name='x', shape=[3, 2, 1], dtype='float32') - # Creates a variable with changable batch size -1. + # Creates a variable with changable batch size. # Users can feed data of any batch size into y, # but size of each data sample has to be [2, 1] - y = fluid.data(name='y', shape=[-1, 2, 1], dtype='float32') + y = fluid.data(name='y', shape=[None, 2, 1], dtype='float32') z = x + y -- GitLab