mindspore.ops.Floor

class mindspore.ops.Floor[source]

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

\[out_i = \lfloor x_i \rfloor\]
Inputs:
  • x (Tensor) - The input tensor. Its element data type must be float16 or float32. \((N,*)\) where \(*\) means, any number of additional dimensions, its rank should be less than 8.

Outputs:

Tensor, has the same shape as x.

Raises
  • TypeError – If x is not a Tensor.

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

Supported Platforms:

Ascend GPU CPU

Examples

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