pub trait AttackLoss: Send + Sync {
// Required methods
fn loss(&self, predictions: &[f64], labels: &[f64]) -> f64;
fn grad(&self, predictions: &[f64], labels: &[f64]) -> Vec<f64>;
}Expand description
A differentiable loss function used by attack algorithms.
Both loss and grad receive raw model outputs (logits or probabilities)
and target labels, and must be thread-safe.