fn
frac
→Tensorfrac(input: Tensor)Element-wise fractional part.
Returns x - trunc(x) for each entry, preserving the sign of the input.
Parameters
inputTensorInput tensor.
Returns
TensorElement-wise result with the same shape as input.
Notes
Mathematical definition:
Output lies in . Gradient is one almost everywhere.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.frac(x)
Tensor([...])