Skip to content
fn

cummin

→_ValuesIndices[Tensor]
cummin(input: Tensor, dim: _int = ...)

Implementing kernel

C++ engine symbols that back this Python API.

Return the running minimum and indices of input along dim.

Output i along dim is the minimum of elements 0..i and the index along dim where that running minimum was reached (on ties, the latest index).

Parameters

inputTensor
Source tensor.
dimint= -1
Dimension to scan along.

Returns

_ValuesIndices[Tensor]

A (values, indices) pair with .values and .indices attributes.

Notes

The gradient of output i flows to the element that set the running minimum at step i; differentiable twice.

Examples

>>> import lucid
>>> x = lucid.tensor([1.0, 3.0, 2.0, 4.0])
>>> lucid.cummin(x, dim=0).values
Tensor([1., 1., 1., 1.])