mindspore.ops.Round

class mindspore.ops.Round(*args, **kwargs)[source]

Returns half to even of a tensor element-wise.

Inputs:
  • x (Tensor) - The input tensor.

Outputs:

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

Raises

TypeError – If x is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

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