newton.utils.leaky_max#

newton.utils.leaky_max(a, b)[source]#

Compute a numerically stable, differentiable approximation of max(a, b).

This is equivalent to smooth_max(a, b, 1e-5).

Parameters:
  • a (float) – The first value.

  • b (float) – The second value.

Returns:

A smooth, “leaky” maximum of a and b.

Return type:

float