l1
L1 parameter regularisation for certified training.
get_l1_reg(model, device='cuda')
Sum absolute parameter values to obtain the L1 training regulariser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
The neural network model to regularize. IMPORTANT: Don't pass the bounded model here. |
required |
device
|
str
|
The device to perform the computation on. |
'cuda'
|
Returns:
| Type | Description |
|---|---|
Tensor
|
The L1 regularisation loss. |
Source code in CTRAIN/train/certified/regularisers/l1.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |