mindspore.Tensor.floor

Tensor.floor() Tensor

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

\[out_i = \lfloor self_i \rfloor\]
Returns

Tensor, has the same shape as self.

Raises

TypeError – If dtype of input is not support. Its supported data types are: - Ascend: float16, float32, float64, bfloat16, int8, int16, int32, int64, uint8, uint16, uint32, uint64. - GPU/CPU: float16, float32, float64.

Supported Platforms:

Ascend GPU CPU

Examples

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