create_tensor¶
- paddle.Tensor. create_tensor ( dtype, name=None, persistable=False )
-
Create a variable, which will hold a Tensor with data type dtype.
- Parameters
-
dtype (string|numpy.dtype) – the data type of Tensor to be created, the data type is bool, float16, float32, float64, int8, int16, int32 and int64.
name (string, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name
persistable (bool) – Set the persistable flag of the create tensor. default value is False.
- Returns
-
The tensor to be created according to dtype.
- Return type
-
Variable
Examples
>>> import paddle >>> tensor = paddle.tensor.create_tensor(dtype='float32')