mindspore.numpy.fix

mindspore.numpy.fix(x)[source]

Rounds to nearest integer towards zero.

Rounds an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats.

Note

Numpy argument out is not supported.

Parameters

x (Tensor) – An array of floats to be rounded.

Returns

Tensor.

Raises

TypeError – if the input is not a tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore.numpy as np
>>> output = np.fix(np.array([2.1, 2.9, -2.1, -2.9]))
>>> print(output)
[ 2.  2. -2. -2.]