未验证 提交 4f5fe971 编写于 作者: W wangchaochaohu 提交者: GitHub

revise the create tensor doc test=develop (#1400)

* revise the create tensor doc test=develop

* revise the create tensor doc test=develop

* revise the create tensor doc test=develop
上级 ef6bb48d
......@@ -5,23 +5,32 @@ create_tensor
.. py:function:: paddle.fluid.layers.create_tensor(dtype,name=None,persistable=False)
创建一个变量,存储数据类型为dtype的LoDTensor。
创建数据类型为dtype的Tensor。
参数:
- **dtype** (string)-“float32”|“int32”|..., 创建张量的数据类型
- **name** (string)-创建张量的名称。如果未设置,则随机取一个唯一的名称
- **persistable** (bool)-是否将创建的张量设置为 persistable
- **dtype** (str|numpy.dtype) - 创建的Tensor的数据类型,支持数据类型为bool, float16, float32, float64, int8, int16, int32, int64
- **name** (str, 可选) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None
- **persistable** (bool,可选) - 用于设置创建的Tensor的persistable属性,若不设置则默认设置为False。
返回:一个张量,存储着创建的张量
返回: 创建的Tensor,数据类型为dtype。
返回类型:变量(Variable)
返回类型:Variable
**代码示例**:
.. code-block:: python
"""
使用print(tensor)打印结果如下:
type {
type: LOD_TENSOR
lod_tensor {
tensor {
data_type: INT8
}
}
}
persistable: false
"""
import paddle.fluid as fluid
tensor = fluid.layers.create_tensor(dtype='float32')
tensor = fluid.layers.create_tensor(dtype='float32')
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册