fn

minimum

Tensor
minimum(input: Tensor, other: Tensor | Scalar)
source

Element-wise minimum with broadcasting.

Returns the smaller of the two operands at each position. NaN propagates: if either entry is NaN the result is NaN.

Parameters

inputTensor
Left operand.
otherTensor or scalar
Right operand. Broadcasts against input following the standard broadcasting rules; Python scalars are promoted to a tensor of matching dtype.

Returns

Tensor

Element-wise result with shape broadcast(input.shape, other.shape) and dtype determined by the usual type-promotion rules.

Notes

Mathematical definition:

outi=min(inputi,otheri)\text{out}_i = \min(\text{input}_i, \text{other}_i)

Gradient flows to whichever operand achieves the minimum; ties are split arbitrarily.

Examples

>>> import lucid
>>> a = lucid.tensor([1.0, 2.0, 3.0])
>>> b = lucid.tensor([4.0, 5.0, 6.0])
>>> lucid.minimum(a, b)
Tensor([...])