diff --git a/python/paddle/fluid/layers/tensor.py b/python/paddle/fluid/layers/tensor.py index 62b01d595a812ee8fc094e40b6dfb5c3f56cd012..6ce486d70d7a3b655118410b96bcb449248ba441 100644 --- a/python/paddle/fluid/layers/tensor.py +++ b/python/paddle/fluid/layers/tensor.py @@ -39,6 +39,25 @@ __all__ = [ def create_tensor(dtype, name=None, persistable=False): + """ + **Create a Tensor with certain data type and name** + + Args: + dtype (string): 'float32'|'int32'|..., the data type of the + created tensor. + name (string|None): The name of the created tensor, if not set, + the name will be a random unique one. + persistable (bool): Set the persistable flag of the create tensor, + default value is False. + + Returns: + Variable: The tensor variable storing the created tensor. + + Examples: + .. code-block:: python + + tensor = fluid.layers.create_tensor(dtype='float32') + """ helper = LayerHelper("create_tensor", **locals()) return helper.create_variable( name=helper.name, dtype=dtype, persistable=persistable)