mindspore.numpy.around

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

Evenly round to the given number of decimals.

Note

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

Parameters
Returns

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

Raises

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

Supported Platforms:

Ascend GPU CPU

Examples

>>> 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.]