Skip to content
fn

ceil

→Tensor
ceil(input: Tensor)

Implementing kernel

C++ engine symbols that back this Python API.

Element-wise ceiling (round toward +∞+\infty).

Returns the least integer-valued float greater 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 = \lceil \text{input}_i \rceil

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

Examples

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