boundlab.zono.linearizers.MaxWithConst2Relu#

class boundlab.zono.linearizers.MaxWithConst2Relu[source]#

Bases: OpHandler

max(x, c) = relu(x - c) + c when one operand is constant, so max inherits the domain’s ReLU relaxation.

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 = 'max'#
condition(x, y, **kwargs)[source]#

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

handle(interp, x, y, **kwargs)[source]#

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 other when both are ready for the same call.

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