mindspore.ops.Round
- class mindspore.ops.Round[source]
Returns half to even of a tensor element-wise.
Refer to
mindspore.ops.round()
for more details.- Inputs:
x (Tensor) - The input tensor.
- Outputs:
Tensor, has the same shape and type as the x.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> 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.]