PGD training loss API
This loss supports native PyTorch classifiers and is used by the
PGD trainer. The attack runs in evaluation mode; adversarial loss
evaluation uses the caller's mode. It returns a scalar loss, or (loss, error_rate)
when return_stats=True. return_bounds=True is unsupported.
The step size is relative to the attack region. These are training controls; see the evaluation guide for evaluation budgets.
Compute the mean criterion on PGD-generated adversarial inputs.
The attack runs in evaluation mode; loss evaluation uses the caller's model mode. return_bounds must be False. Returns the scalar loss, or (loss, adversarial_error) when return_stats=True.
Source code in CTRAIN/train/adversarial/losses/pgd.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |