zero_

paddle.Tensor. zero_ ( x )
Notes:

This API is ONLY available in Dygraph mode

This function fill the Tensor with zero inplace.

Parameters

x (Tensor) – x is the Tensor we want to filled with zero inplace

Returns

x (Tensor), Tensor x filled with zero inplace

Examples

>>> import paddle

>>> tensor = paddle.to_tensor([0, 1, 2, 3, 4])

>>> tensor.zero_()
>>> print(tensor.tolist())
[0, 0, 0, 0, 0]