min(input: Tensor, dim: _int | list[_int] | None = None, keepdim: _bool = False)Implementing kernel
C++ engine symbols that back this Python API.Return the smallest element of input, or the smallest along dim.
Only the values come back. The reference framework's min(x, dim)
returns a (values, indices) pair; here argmin gives the
positions, and lucid.topk(x, 1, dim, largest=False) returns both.
Parameters
inputTensorInput tensor.
dimint or list of int= NoneAxis or axes to reduce.
None reduces every element.keepdimbool= FalseKeep each reduced axis with size 1.
Returns
TensorThe smallest values; x.shape with the reduced axes removed (or
kept as 1).
Notes
NaN propagates: a slice holding NaN reduces to NaN. The gradient is
shared equally among the positions tied for the smallest value, so the
shares sum to one — the subgradient the reference framework's
amin gives.
Examples
>>> import lucid
>>> x = lucid.tensor([[1.0, 4.0], [3.0, 2.0]])
>>> lucid.min(x)
Tensor(1.)
>>> lucid.min(x, dim=1)
Tensor([1., 2.])