boundlab.zono.linearizers.Tanh#
- class boundlab.zono.linearizers.Tanh[source]#
Bases:
OpHandlerMinimal-derivative enclosure of \(\tanh\) (DeepZ-style).
The slope \(\lambda = \min(1 - \tanh^2 l,\; 1 - \tanh^2 u)\) never exceeds the true derivative anywhere in \([l, u]\) (\(\tanh'\) is unimodal), so the residual \(\tanh(x) - \lambda x\) is monotone and attains its extremes at the endpoints; \(\mu\) and \(\beta\) center that endpoint range.
Methods
Whether this handler applies to these operands (default: always).
Transform the operands; sub-operations go through
interp.<op>so the enclosing domain's handlers apply to them too.A copy of this handler that takes precedence over
otherwhen both are ready for the same call.- __call__(l, u, x=None)#
Call self as a function.
- __init__(op='tanh', apply_bound=<function linearizer_fn.<locals>.decorator.<locals>.LinearizerHandler.<lambda>>)#
- apply_bound(x)#
- condition(x, **kwargs)#
Whether this handler applies to these operands (default: always).
- handle(interp, x, **kwargs)#
Transform the operands; sub-operations go through
interp.<op>so the enclosing domain’s handlers apply to them too.
- override_handler(other)#
A copy of this handler that takes precedence over
otherwhen both are ready for the same call.