- paddle. full ( shape, fill_value, dtype=None, name=None )
This Op return a Tensor with the
fill_valuewhich size is same as
shape (list|tuple|Tensor) – Shape of the Tensor to be created. The data type is
shapeis a list or tuple, the elements of it should be integers or Tensors with shape . If
shapeis an Tensor, it should be an 1-D Tensor .
fill_value (bool|float|int|Tensor) – The constant value used to initialize the Tensor to be created. If
fill_valueis an Tensor, it must be an 1-D Tensor.
dtype (np.dtype|str, optional) – Data type of the output Tensor which can be float16, float32, float64, int32, int64, if dytpe is None, the data type of created Tensor is float32
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
Tensor which is created according to
- Return type
import paddle data1 = paddle.full(shape=[2,1], fill_value=0, dtype='int64') #[ # ] # attr shape is a list which contains Tensor. positive_2 = paddle.full(, 2, "int32") data3 = paddle.full(shape=[1, positive_2], dtype='float32', fill_value=1.5) # [[1.5 1.5]] # attr shape is a Tensor. shape = paddle.full(, 2, "int32") data4 = paddle.full(shape=shape, dtype='bool', fill_value=True) # [[True True] # [True True]] # attr fill_value is a Tensor. val = paddle.full(, 2.0, "float32") data5 = paddle.full(shape=[2,1], fill_value=val, dtype='float32') # [[2.0] # [2.0]]