mindspore.ops.round
- mindspore.ops.round(x)[source]
Returns half to even of a tensor element-wise.
\[out_i \approx x_i\]- Parameters
x (Tensor) – The input tensor.
- Returns
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) >>> output = ops.round(x) >>> print(output) [ 1. 2. 2. 2. -4.]