min_rrule

Function min_rrule 

Source
pub fn min_rrule<R: Float>(x: R, y: R, cotangent: R) -> (R, R)
Expand description

Reverse rule for min.

When x == y, the cotangent goes to y. If exactly one input is NaN, the non-NaN input receives the cotangent.

ยงExamples

use chainrules::min_rrule;

let (dx, dy) = min_rrule(1.0_f64, 2.0_f64, 0.5);
assert_eq!(dx, 0.5);
assert_eq!(dy, 0.0);