fill_¶
- paddle.Tensor. fill_ ( x, value )
-
- Notes:
-
This API is ONLY available in Dygraph mode
This function fill the Tensor with value inplace.
- Parameters
-
x (Tensor) –
x
is the Tensor we want to filled data inplacevalue (Scale) –
value
is the value to be filled in x
- Returns
-
x(Tensor), Tensor x filled with value inplace
Examples
import paddle tensor = paddle.to_tensor([0, 1, 2, 3, 4]) tensor.fill_(0) print(tensor.tolist()) #[0, 0, 0, 0, 0]