crown
bound_crown(model, ptb, data, target, n_classes=10, bound_upper=False, reuse_input=False)
Compute the lower and upper bounds of the model's output using the CROWN method.
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. Default is 10. |
10
|
bound_upper
|
bool
|
Whether to compute the upper bound. Default is False. |
False
|
reuse_input
|
bool
|
Whether to reuse the input data from previous bounding operation. Default is False. |
False
|
Returns:
Type | Description |
---|---|
Tuple[Tensor, Tensor]
|
The lower and upper bounds of the model's output. |
Source code in CTRAIN/bound/crown.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 |
|
bound_crown_ibp(model, ptb, data, target, n_classes=10, bound_upper=False, reuse_input=False)
Compute the lower and upper bounds of the model's output using the CROWN-IBP method.
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. Default is 10. |
10
|
bound_upper
|
bool
|
Whether to compute the upper bound. Default is False. |
False
|
reuse_input
|
bool
|
Whether to reuse the input data from previous bounding operation. Default is False. |
False
|
Returns:
Type | Description |
---|---|
Tuple[Tensor, Tensor]
|
The lower and upper bounds of the model's output. |
Source code in CTRAIN/bound/crown.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|