pub struct AttentionSelector { /* private fields */ }Implementations§
Source§impl AttentionSelector
impl AttentionSelector
pub fn new( mechanisms: Vec<Box<dyn DagAttentionMechanism>>, config: SelectorConfig, ) -> Self
Sourcepub fn get_mechanism(&self, idx: usize) -> Option<&dyn DagAttentionMechanism>
pub fn get_mechanism(&self, idx: usize) -> Option<&dyn DagAttentionMechanism>
Get the selected mechanism
Sourcepub fn get_mechanism_mut(
&mut self,
idx: usize,
) -> Option<&mut Box<dyn DagAttentionMechanism>>
pub fn get_mechanism_mut( &mut self, idx: usize, ) -> Option<&mut Box<dyn DagAttentionMechanism>>
Get mutable reference to mechanism for updates
Sourcepub fn stats(&self) -> HashMap<&'static str, MechanismStats>
pub fn stats(&self) -> HashMap<&'static str, MechanismStats>
Get statistics for all mechanisms
Sourcepub fn best_mechanism(&self) -> Option<usize>
pub fn best_mechanism(&self) -> Option<usize>
Get the best performing mechanism based on average reward
Sourcepub fn forward(
&mut self,
dag: &QueryDag,
) -> Result<(AttentionScores, usize), AttentionError>
pub fn forward( &mut self, dag: &QueryDag, ) -> Result<(AttentionScores, usize), AttentionError>
Forward pass using selected mechanism
Auto Trait Implementations§
impl Freeze for AttentionSelector
impl !RefUnwindSafe for AttentionSelector
impl Send for AttentionSelector
impl Sync for AttentionSelector
impl Unpin for AttentionSelector
impl UnsafeUnpin for AttentionSelector
impl !UnwindSafe for AttentionSelector
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