floor¶
向下取整函数。
\[out = \left \lfloor x \right \rfloor\]
返回¶
输出为Tensor,与 x
维度相同、数据类型相同。
代码示例¶
import paddle
data1 = paddle.full(shape=[3, 2], fill_value=2.5, dtype='float32') # [[2.5, 2.5], [2.5, 2.5], [2.5, 2.5]]
data2 = paddle.full(shape=[2, 3], fill_value=-2.5, dtype='float64') # [[-2.5, -2.5, -2.5], [-2.5, -2.5, -2.5]]
result1 = paddle.floor(data1) # [[2., 2.], [2., 2.], [2., 2.]]
result2 = paddle.floor(data2) # [[-3., -3., -3.], [-3., -3., -3.]]
print(result1)
print(result2)