[][src]Struct xaynet_core::mask::Masker

pub struct Masker { /* fields omitted */ }

A masker for models.

Implementations

impl Masker[src]

pub fn new(config: MaskConfig) -> Self[src]

Creates a new masker with the given masking configuration with a randomly generated seed.

pub fn with_seed(config: MaskConfig, seed: MaskSeed) -> Self[src]

Creates a new masker with the given masking configuration and seed.

impl Masker[src]

pub fn mask(
    self,
    scalar: f64,
    model: Model
) -> (MaskSeed, MaskObject, MaskObject)
[src]

Masks the given model wrt the masking configuration. Enforces bounds on the scalar and weights.

The masking proceeds in the following steps:

  • Clamp the scalar and the weights according to the masking configuration.
  • Scale the weights by the scalar.
  • Shift the weights into the non-negative reals.
  • Shift the weights into the non-negative integers.
  • Shift the weights into the finite group.
  • Mask the weights with random elements from the finite group.

The random elements are derived from a seeded PRNG. Unmasking as performed in unmask() proceeds in reverse order.

Auto Trait Implementations

impl RefUnwindSafe for Masker

impl Send for Masker

impl Sync for Masker

impl Unpin for Masker

impl UnwindSafe for Masker

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,