提交 4d0fd7e7 编写于 作者: Q qiaolongfei

add API reference for create_tensor

上级 2c1e2caa
...@@ -39,6 +39,25 @@ __all__ = [ ...@@ -39,6 +39,25 @@ __all__ = [
def create_tensor(dtype, name=None, persistable=False): 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()) helper = LayerHelper("create_tensor", **locals())
return helper.create_variable( return helper.create_variable(
name=helper.name, dtype=dtype, persistable=persistable) name=helper.name, dtype=dtype, persistable=persistable)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册