mindspore.ops.floor

mindspore.ops.floor(input)[source]

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

\[out_i = \lfloor x_i \rfloor\]
Parameters

input (Tensor) – The input tensor, \(x\) in the above formula. Its data type must be float16, float32 or float64.

Returns

Tensor, has the same shape as input.

Raises
  • TypeError – If input is not a Tensor.

  • TypeError – If dtype of input is not in [float16, float32, float64].

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> input = Tensor(np.array([1.1, 2.5, -1.5]), mindspore.float32)
>>> output = ops.floor(input)
>>> print(output)
[ 1.  2. -2.]