boundlab.interp.OpHandler#

class boundlab.interp.OpHandler[source]#

Bases: object

One implementation of an ONNX-level operator.

A handler declares which operator it implements (op), when it applies (condition(), typically a check on the operand classes), and the transformation itself (handle()). For every dispatched call exactly one registered handler must be ready; overrides breaks declared ties.

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#
overrides: list[type[OpHandler]] = []#
override_handler(other)[source]#

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

condition(*args, **kwargs)[source]#

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

abstractmethod handle(interp, *args, **kwargs)[source]#

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