pub fn fgsm(
model: &dyn AttackModel,
loss: &dyn AttackLoss,
input: &[f64],
labels: &[f64],
config: &AttackConfig,
) -> Result<AdversarialExample, AdversarialError>Expand description
Fast Gradient Sign Method (Goodfellow et al., 2014).
Computes a single-step adversarial perturbation:
- L∞: δ = ε · sign(∇_x L)
- L2: δ = ε · ∇_x L / ‖∇_x L‖₂
- L1: δ = ε · e_k where k = argmax |∂L/∂xᵢ|