Minimum and maximum #
The captured minimum and maximum operations use the same comparison masks as their two-input runtime counterparts. A strict winner receives the full upstream gradient, a strict loser receives zero, and each input receives half at a tie. Capturing the right-hand tensor leaves that selection unchanged.
We first identify the stored backward functions coordinate by coordinate, including their value at ties. We then prove that these functions are the adjoints of the forward derivatives wherever every input coordinate differs from its captured partner. The equality case has a selected backward rule, but no classical derivative is claimed there.
The actual minimum backward multiplies by its selected comparison mask at each coordinate.
The actual maximum backward keeps the same comparison order as the runtime selection.
A minimum tie retains half the upstream gradient even when the other input is captured.
A maximum tie uses the same half-gradient selection as minimum.
Away from all coordinate ties, the minimum mask is the derivative of its tensor forward.
Away from all coordinate ties, the maximum mask is the derivative of its tensor forward.
The stored minimum backward is the adjoint of the forward derivative away from ties.
The stored maximum backward is the adjoint of the forward derivative away from ties.