pub enum LossHandler {
Ignore,
Reweight(EnvelopeReweightPolicy),
Handoff,
}Expand description
A validated loss strategy together with its options.
Build with LossHandler::new at coordinator construction; every later
decision is a total function on this value, so a decode never fails on
configuration.
Variants§
Implementations§
Source§impl LossHandler
impl LossHandler
Sourcepub fn new(strategy: LossStrategy, config: Value) -> Result<Self, String>
pub fn new(strategy: LossStrategy, config: Value) -> Result<Self, String>
Parse and validate config against strategy.
Returns a human-readable error when the blob carries an option the chosen strategy does not accept, or a value outside its domain.
Sourcepub fn tracks_losses(self) -> bool
pub fn tracks_losses(self) -> bool
Whether observed losses have to be recorded per gadget and assembled into
loss sites. False only for LossStrategy::Ignore, which lets the
coordinator skip the whole loss pipeline.
Sourcepub fn hands_off_to_decoder(self) -> bool
pub fn hands_off_to_decoder(self) -> bool
Whether the assembled sites go to the decoder as a structured LossInfo
rather than being flattened into reweighted hyperedges.
Sourcepub fn reweight_policy(self) -> Option<EnvelopeReweightPolicy>
pub fn reweight_policy(self) -> Option<EnvelopeReweightPolicy>
The configured policy when this handler reweights loss envelopes.
Source§impl LossHandler
impl LossHandler
Sourcepub fn validate_capability(
self,
gadget_types: &[GadgetType],
features: DecoderFeatures,
) -> Result<(), Status>
pub fn validate_capability( self, gadget_types: &[GadgetType], features: DecoderFeatures, ) -> Result<(), Status>
Validate that the decoder capabilities support this loss strategy for the supplied gadget library.
Trait Implementations§
Source§impl Clone for LossHandler
impl Clone for LossHandler
impl Copy for LossHandler
Source§impl Debug for LossHandler
impl Debug for LossHandler
Source§impl Default for LossHandler
Matches LossStrategy::default: reweight at [DEFAULT_WEIGHT_FRACTION].
impl Default for LossHandler
Matches LossStrategy::default: reweight at [DEFAULT_WEIGHT_FRACTION].
Source§impl PartialEq for LossHandler
impl PartialEq for LossHandler
impl StructuralPartialEq for LossHandler
Auto Trait Implementations§
impl Forget for LossHandler
impl Freeze for LossHandler
impl Move for LossHandler
impl RefUnwindSafe for LossHandler
impl Send for LossHandler
impl Sync for LossHandler
impl Unpin for LossHandler
impl UnsafeUnpin for LossHandler
impl UnwindSafe for LossHandler
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request