shi
Weight initialisation for stable IBP training following Shi et al. (2021).
get_params(model)
Collect named weight and bias parameter pairs for Shi initialisation.
Source code in CTRAIN/train/certified/initialisation/shi.py
6 7 8 9 10 11 12 13 14 15 16 17 | |
ibp_init_shi(model_ori, model, init_last_layer=False, zero_bias=False)
Initialise weights for stable IBP training following Shi et al. (2021).
Affine and convolutional weights use standard deviation sqrt(2*pi)/fan_in. By default the final named weight tensor and existing biases are retained; init_last_layer and zero_bias explicitly change those choices. Residual connections receive the corresponding scale adjustment in the bounded graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_ori
|
Module
|
The original model. |
required |
model
|
BoundedModule
|
The LiRPA model. |
required |
init_last_layer
|
bool
|
Also reinitialize the final weight tensor. False preserves the original Shi code's exclusion. |
False
|
zero_bias
|
bool
|
Zero all named bias parameters, including BN offsets. False preserves their existing values. |
False
|
Returns:
| Type | Description |
|---|---|
None
|
This function updates the supplied state in place. |
Source code in CTRAIN/train/certified/initialisation/shi.py
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 50 51 52 53 54 55 56 57 | |