fn
trunc
→Tensortrunc(input: Tensor)Element-wise truncation toward zero.
Removes the fractional part, returning the integer-valued float nearest to zero.
Parameters
inputTensorInput tensor.
Returns
TensorElement-wise result with the same shape as input.
Notes
Mathematical definition:
Equivalent to floor for positive inputs and ceil for negative inputs.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.trunc(x)
Tensor([...])