mindspore.ops.Floor

View Source On Gitee
class mindspore.ops.Floor[source]

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

Refer to mindspore.ops.floor() for more details.

Inputs:
  • x (Tensor) - The input tensor. Supported dtypes:

    • Ascend: float16, float32.

    • GPU/CPU: float16, float32, float64.

Outputs:

Tensor, has the same shape as x.

Supported Platforms:

Ascend GPU CPU

Examples

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