mindspore.numpy.around

mindspore.numpy.around(a, decimals=0)[源代码]

Evenly round to the given number of decimals.

说明

Numpy argument out is not supported. Complex numbers are not supported.

参数
返回

Tensor. A tensor of the same type as a, containing the rounded values. The result of rounding a float is a float.

异常

TypeError – If the input can not be converted to a tensor or the decimals argument is not integer.

Supported Platforms:

Ascend GPU CPU

样例

>>> import mindspore.numpy as np
>>> a = np.array([-1.3, 0.0, 0.5, 1.5, 2.5])
>>> print(np.around(a))
[-1. 0. 0. 2. 2.]