boundlab.poly.tanh_linearizer#

boundlab.poly.tanh_linearizer(ub, lb)[source]#

CROWN relaxation of \(\tanh\).

tanh is concave for \(x \ge 0\) and convex for \(x \le 0\). For each neuron we use the common CROWN envelope:

  • When both bounds share a sign, the tight secant forms the concave- side envelope and a tangent (at the bound midpoint) forms the convex-side envelope.

  • For sign-crossing intervals we use the minimum-slope line through the respective endpoint on each side, giving a sound (though not tightest-possible) relaxation.