[−][src]Struct xaynet_core::mask::Masker
A masker for models.
Implementations
impl Masker
[src]
pub fn new(config: MaskConfig) -> Self
[src]
Creates a new masker with the given masking config
uration with a randomly generated seed.
pub fn with_seed(config: MaskConfig, seed: MaskSeed) -> Self
[src]
Creates a new masker with the given masking config
uration and seed
.
impl Masker
[src]
pub fn mask(
self,
scalar: f64,
model: Model
) -> (MaskSeed, MaskObject, MaskObject)
[src]
self,
scalar: f64,
model: Model
) -> (MaskSeed, MaskObject, MaskObject)
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,