mindspore.ops.floor

View Source On Gitee
mindspore.ops.floor(input)[source]

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

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

input (Tensor) –

The input tensor. Its supported data types are:

  • Ascend: float16, float32, float64, bfloat16, int8, int16, int32, int64, uint8, uint16, uint32, uint64.

  • GPU/CPU: float16, float32, float64.

Returns

Tensor, has the same shape as input.

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