[−][src]Struct xaynet::mask::Aggregation
An aggregator for masks and masked models.
Implementations
impl Aggregation
[src]
pub fn new(config: MaskConfig, object_size: usize) -> Self
[src]
Creates a new, empty aggregator for masks or masked models.
pub fn len(&self) -> usize
[src]
Gets the length of the aggregated mask object.
pub fn config(&self) -> MaskConfig
[src]
Gets the masking configuration of the aggregator.
pub fn validate_unmasking(
&self,
mask: &MaskObject
) -> Result<(), UnmaskingError>
[src]
&self,
mask: &MaskObject
) -> Result<(), UnmaskingError>
Validates if unmasking of the aggregated masked model with the given mask
may be
safely performed.
This should be checked before calling unmask()
, since unmasking may return garbage
values otherwise.
Errors
Fails in one of the following cases:
- The aggregator has not yet aggregated any models.
- The number of aggregated masked models is larger than the chosen masking configuration allows.
- The masking configuration of the aggregator and of the
mask
don't coincide. - The length of the aggregated masked model and the
mask
don't coincide. - The
mask
itself is invalid.
Even though it does not produce any meaningful values, it is safe and technically possible
due to the MaskObject
type to validate, that:
- a mask may unmask another mask
- a masked model may unmask a mask
- a masked model may unmask another masked model
pub fn unmask(self, mask: MaskObject) -> Model
[src]
Unmasks the aggregated masked model with the given mask
.
It should be checked that validate_unmasking()
succeeds before calling this, since
unmasking may return garbage values otherwise. The unmasking is performed in opposite order
as described for mask()
.
Panics
This may only panic if validate_unmasking()
fails.
Even though it does not produce any meaningful values, it is safe and technically possible
due to the MaskObject
type to unmask:
- a mask with another mask
- a mask with a masked model
- a masked model with another masked model
if validate_unmasking()
returns true
.
pub fn validate_aggregation(
&self,
object: &MaskObject
) -> Result<(), AggregationError>
[src]
&self,
object: &MaskObject
) -> Result<(), AggregationError>
Validates if aggregation of the aggregated mask object with the given object
may be safely
performed.
This should be checked before calling aggregate()
, since aggregation may return garbage
values otherwise.
Errors
Fails in one of the following cases:
- The masking configuration of the aggregator and of the
object
don't coincide. - The length of the aggregated masks or masked model and the
object
don't coincide. If the aggregator is empty, then anobject
of any length may be aggregated. - The new number of aggregated masks or masked models would exceed the number that the chosen masking configuration allows.
- The
object
itself is invalid.
Even though it does not produce any meaningful values, it is safe and technically possible
due to the MaskObject
type to validate, that a mask may be aggregated with a masked
model.
pub fn aggregate(&mut self, object: MaskObject)
[src]
Aggregates the aggregated mask object with the given object
.
It should be checked that validate_aggregation()
succeeds before calling this, since
aggregation may return garbage values otherwise.
Errors
Even though it does not produce any meaningful values, it is safe and technically possible
due to the MaskObject
type to aggregate a mask with a masked model if
validate_aggregation()
returns true
.
Trait Implementations
impl Debug for Aggregation
[src]
impl From<MaskObject> for Aggregation
[src]
fn from(object: MaskObject) -> Self
[src]
impl Into<MaskObject> for Aggregation
[src]
fn into(self) -> MaskObject
[src]
Auto Trait Implementations
impl RefUnwindSafe for Aggregation
impl Send for Aggregation
impl Sync for Aggregation
impl Unpin for Aggregation
impl UnwindSafe for Aggregation
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> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
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>,
fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,