Reduction operator bounds #
This file defines simple IBP and affine transfer rules for common reductions over flattened vectors (sum/mean/max/min/prod). These rules are primarily intended for the graph-based verifier.
Non-smooth reductions (max/min) are treated conservatively (interval enclosures), and prod
is treated as a bilinear-style operation (also conservatively).
Helper to extract scalar from dim-scalar tensor.
Instances For
Compute sum of a 1D tensor.
Instances For
IBP for ReduceMax: max over intervals. lo = max of individual lower bounds (conservative but sound) hi = max of individual upper bounds
Note: This is conservative. The true lower bound on max(x) is max(min_i x_i), but we use max(lo_i) which may be looser.
Instances For
IBP for ReduceProd: product over intervals. This is more complex due to sign changes. For each element, compute all 4 corner products and take min/max.
For n elements: Π[lo_i, hi_i] requires 2^n evaluations in general. We use a recursive interval multiplication approach.
Instances For
Derivative bounds for ReduceMax: non-smooth, uses subgradient. ∂max/∂x_i = 1 if x_i is the max, 0 otherwise. For intervals, we bound: derivative ∈ [0, 1] for argmax candidates.
Instances For
IBP for ReduceSum along axis 0 (sum over rows) for 2D: [rows, cols] → [1, cols]. Each output column j = Σ_i input[i,j].
Instances For
IBP for ReduceSum along axis 1 (sum over columns) for 2D: [rows, cols] → [rows, 1]. Each output row i = Σ_j input[i,j].
Instances For
ReduceSum output dimension is 1.
ReduceMean output dimension is 1.
ReduceMax output dimension is 1.
ReduceMin output dimension is 1.
ReduceProd output dimension is 1.
Affine reduce sum output dimension is 1.