mindspore.Tensor.round

Tensor.round()[source]

Returns half to even of the tensor element-wise.

Returns

Tensor, has the same shape and type as the Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> x = Tensor(np.array([0.8, 1.5, 2.3, 2.5, -4.5]), mindspore.float32)
>>> output = x.round()
>>> print(output)
[ 1.  2.  2.  2. -4.]