mindspore.ops.Round

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

Returns half to even of a tensor element-wise.

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

Outputs:

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

Raises

TypeError – If input_x is not a Tensor.

Supported Platforms:

Ascend

Examples

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