mindspore.ops.Floor

class mindspore.ops.Floor(*args, **kwargs)[source]

Rounds a tensor down to the closest integer element-wise.

\[out_i = \lfloor x_i \rfloor\]
Inputs:
  • input_x (Tensor) - The input tensor. Its element data type must be float.

Outputs:

Tensor, has the same shape as input_x.

Raises

TypeError – If dtype of input_x is not float.

Supported Platforms:

Ascend GPU CPU

Examples

>>> input_x = Tensor(np.array([1.1, 2.5, -1.5]), mindspore.float32)
>>> floor = ops.Floor()
>>> output = floor(input_x)
>>> print(output)
[ 1.  2. -2.]