mindspore.ops.round
- mindspore.ops.round(input)[源代码]
- 对输入数据进行四舍五入到最接近的整数数值。 \[out_i \approx input_i\]- 参数:
- input (Tensor) - 输入Tensor。 
 
- 返回:
- Tensor,shape和数据类型与输入 input 相同。 
- 异常:
- TypeError - input 不是Tensor。 
 
- 支持平台:
- Ascend- GPU- CPU
 - 样例: - >>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> input = Tensor(np.array([0.8, 1.5, 2.3, 2.5, -4.5]), mindspore.float32) >>> output = ops.round(input) >>> print(output) [ 1. 2. 2. 2. -4.]