Conv2D #
Conv2D CROWN-IBP bounds in TorchLean.
We provide:
- Interval Bound Propagation (IBP) for Conv2D pre-activations
- A CROWN-IBP affine bound for Conv2D+ReLU, evaluated on a flattened input box
Design notes:
- For simplicity and generality, we flatten the 3D image input and the 3D conv output to 1D vectors when evaluating affine forms. This reuses AffineVec and its safe evaluation on input boxes.
- The conv linear operator is explicitly materialized as a matrix Wconv whose rows correspond to output positions and columns to input positions. This keeps the verifier simple and deterministic for the tensor sizes targeted by the CROWN operator layer.
Flatten a Box to a 1D box by flattening both endpoints.
Instances For
Interval Bound Propagation (IBP) for Conv2D pre-activations y = conv(x, K) + b.
This computes per-output-position min/max bounds by taking min/max of each product term.
Instances For
Build the explicit Conv2D linear operator matrix Wconv mapping flat input to flat output.
Shapes:
- Input:
inC × inH × inW(flat sizeinC*inH*inW) - Output (pre-activation, without bias):
outC × outH × outW(flat sizeoutC*outH*outW)
Entry Wconv[r,c] is the contribution of input coordinate c to output coordinate r.
Instances For
Row-wise scaling of a matrix by a vector: scale each row i by v[i].
Instances For
Broadcast a per-channel bias vector across spatial positions, as a flattened output vector.
Instances For
Construct the CROWN-IBP affine form for Conv2D followed by ReLU, with respect to the flattened
input.
This returns an AffineVec (A,c) so it can be composed with subsequent linear layers. Evaluation
on an input box can then be performed with AffineVec.eval_on_box.
Instances For
Evaluate the Conv2D+ReLU CROWN-IBP affine bound on a flattened input box.
Returns a Box over the flattened conv output dimension.