mindspore.Tensor.zero_

View Source On Gitee
Tensor.zero_()[source]

Return a tensor filled with zeros.

Warning

This is an experimental API that is subject to change or deletion.

Returns

Return a tensor. Fill self tensor with zeros.

Supported Platforms:

Ascend

Examples

>>> import numpy as np
>>> import mindspore
>>> from mindspore import Tensor
>>> x = Tensor(np.array([2, 2]))
>>> output = x.zero_()
>>> print(output)
[[0. 0.]
 [0. 0.]]