boundlab.diff.op#

Operators for differential verification.

Registers boundlab::diff_pair as a torch.library custom operator so that it can be captured by torch.export.export(). The operator takes two tensors of the same shape and returns a single fake tensor of the same shape — a no-op at the concrete-tensor level whose sole purpose is to mark two branches as a paired input for differential abstract interpretation.

When a Interpreter processes an exported graph, the diff_pair node is converted to a DiffExpr2 by the registered handler.

Functions

diff_pair

Mark two tensors as a differentially-paired input.

Classes

DiffLinear

Two parallel linear layers whose outputs are paired via diff_pair().