boundlab.ibp.Softmax2ExpReciprocal#

class boundlab.ibp.Softmax2ExpReciprocal[source]#

Bases: OpHandler

Rewrite softmax as \(1 / \sum_j e^{\nu_j - \nu_i}\) over the last axis.

The exp and reciprocal steps go through the enclosing domain’s handlers (overridable via interp_exp / interp_reciprocal). The denominator is also evaluated in plain interval arithmetic and joined with the symbolic version through Intersects, so the reciprocal sees the tighter of the two enclosures per element — the interval one wins exactly where symbolic cancellation has degenerated.

Methods

__init__

condition

Whether this handler applies to these operands (default: always).

handle

Transform the operands; sub-operations go through interp.<op> so the enclosing domain's handlers apply to them too.

override_handler

A copy of this handler that takes precedence over other when both are ready for the same call.

op: str = 'softmax'#
interp_exp: OpHandler | None = None#
interp_reciprocal: OpHandler | None = None#
condition(x, **params)[source]#

Whether this handler applies to these operands (default: always).

handle(interp, x, **params)[source]#

Transform the operands; sub-operations go through interp.<op> so the enclosing domain’s handlers apply to them too.

__init__(op='softmax', interp_exp=None, interp_reciprocal=None)#
override_handler(other)#

A copy of this handler that takes precedence over other when both are ready for the same call.

overrides: list[type[OpHandler]] = []#