floor

paddle. floor ( x, name=None, *, out=None ) [源代码]

向下取整函数。

\[out = \left \lfloor x \right \rfloor\]

参数

  • x - 输入为多维 Tensor。数据类型支持 float32, float64, float16, bfloat16, uint8, int8, int16, int32, int64。别名 input

  • name (str,可选) - 具体用法请参见 api_guide_Name,一般无需设置,默认值为 None。

关键字参数

  • out (Tensor,可选) - 输出 Tensor,若不为 None,计算结果将保存在该 Tensor 中,默认值为 None

返回

输出为 Tensor,与 x 维度相同、数据类型相同。

代码示例

>>> import paddle

>>> x = paddle.to_tensor([-0.4, -0.2, 0.1, 0.3])
>>> out = paddle.floor(x)
>>> print(out)
Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
[-1., -1.,  0.,  0.])