boundlab.prop#

Bound Propagation for Concretizing Expressions

This module provides functions for computing concrete upper and lower bounds from symbolic expressions through backward-mode propagation.

Examples

>>> import torch
>>> import boundlab.expr as expr
>>> import boundlab.prop as prop
>>> x = expr.ConstVal(torch.tensor([1.0, -1.0])) + expr.LpEpsilon([2])
>>> ub = prop.ub(x)
>>> lb = prop.lb(x)
>>> ub.shape, lb.shape
(torch.Size([2]), torch.Size([2]))

Functions

ub

Compute an upper bound via backward bound propagation.

lb

Compute a lower bound via backward bound propagation.

ublb

Compute both upper and lower bounds for the given expression.

center

Compute the midpoint of the concretized interval.

bound_width

Compute interval width from concretized bounds.

max_bound_width

Compute the maximum interval width over all output dimensions.

bound_width_reasons_breakdown

Compute interval width breakdown by reason.

eqprop

Work like ublb but stops when == propagation is no longer possible, returning an expression.