ibp
Compute interval bounds for certified losses and incomplete verification.
bound_ibp(model, ptb, data, target, n_classes=10, bound_upper=False, reuse_input=False, loss_fusion=False, relu_upper_retention=1.0)
Compute interval bounds on outputs or true-class classification margins.
IBP propagates an input interval through the network using auto_LiRPA. When target labels are supplied, the bounded quantities are the true-class logits minus each competing logit. With target=None, raw outputs are bounded. ReLU retention below one is intended only as an unsound training surrogate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
BoundedModule
|
The neural network model for which bounds are to be computed. |
required |
ptb
|
PerturbationLpNorm
|
The perturbation object defining the perturbation set. |
required |
data
|
Tensor
|
The input data tensor. |
required |
target
|
Tensor
|
The target labels tensor. |
required |
n_classes
|
int
|
The number of classes for classification. |
10
|
bound_upper
|
bool
|
Whether to compute the upper bound. |
False
|
reuse_input
|
bool
|
Whether to reuse the input data from previous bounding operation. |
False
|
loss_fusion
|
bool
|
Whether to use loss fusion. |
False
|
relu_upper_retention
|
float
|
Unstable ReLU upper bound fraction for this training bound; default 1. Values below 1 are not sound certificates. |
1.0
|
Returns:
| Type | Description |
|---|---|
tuple
|
Lower and optional upper bounds on the requested outputs or margins. The upper entry is None when upper bounds are not computed. |
Source code in CTRAIN/bound/ibp.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |