Skip to content
fn

fix

→Tensor
fix(input: Tensor)

Round elements towards zero.

Alias of lucid.trunc: each element loses its fractional part, so positive values round down and negative values round up.

Parameters

inputTensor
Input tensor.

Returns

Tensor

The truncated tensor, with the shape and dtype of input.

Examples

>>> import lucid
>>> lucid.fix(lucid.tensor([1.5, -1.5]))
tensor([1., -1.])