pub struct AdversarialExample {
pub original: Vec<f64>,
pub perturbed: Vec<f64>,
pub perturbation: Vec<f64>,
pub perturbation_norm: f64,
pub n_iterations: usize,
}Expand description
The result of running an adversarial attack on a single input.
Fields§
§original: Vec<f64>The clean (unperturbed) input.
perturbed: Vec<f64>The perturbed input original + perturbation.
perturbation: Vec<f64>The additive perturbation δ = perturbed − original.
perturbation_norm: f64The actual norm of the perturbation (measured in the configured norm).
n_iterations: usizeNumber of attack iterations performed (1 for FGSM).
Implementations§
Source§impl AdversarialExample
impl AdversarialExample
Sourcepub fn perturbation_linf(&self) -> f64
pub fn perturbation_linf(&self) -> f64
L∞ norm of the perturbation: max |δᵢ|.
Sourcepub fn perturbation_l2(&self) -> f64
pub fn perturbation_l2(&self) -> f64
L2 norm of the perturbation: √(Σ δᵢ²).
Sourcepub fn perturbation_l1(&self) -> f64
pub fn perturbation_l1(&self) -> f64
L1 norm of the perturbation: Σ |δᵢ|.
Trait Implementations§
Source§impl Clone for AdversarialExample
impl Clone for AdversarialExample
Source§fn clone(&self) -> AdversarialExample
fn clone(&self) -> AdversarialExample
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AdversarialExample
impl RefUnwindSafe for AdversarialExample
impl Send for AdversarialExample
impl Sync for AdversarialExample
impl Unpin for AdversarialExample
impl UnsafeUnpin for AdversarialExample
impl UnwindSafe for AdversarialExample
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more