Skip to content
fn

floor

→Tensor
floor(input: Tensor)

Implementing kernel

C++ engine symbols that back this Python API.

Element-wise floor (round toward −∞-\infty).

Returns the greatest integer-valued float less than or equal to each entry.

Parameters

inputTensor
Input tensor.

Returns

Tensor

Element-wise result with the same shape as input.

Notes

Mathematical definition:

outi=⌊inputi⌋\text{out}_i = \lfloor \text{input}_i \rfloor

Gradient is zero almost everywhere and treated as zero in autograd.

Examples

>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.floor(x)
Tensor([...])