pub struct ArgmaxTracker { /* private fields */ }Expand description
Tracks winner indices from tropical forward-pass operations.
During a tropical contraction C[i,j] = max_k (A[i,k] + B[k,j]),
the tracker records which k achieved the maximum for each (i,j).
The backward pass uses these indices to route gradients.
§Examples
ⓘ
use tenferro_tropical::ArgmaxTracker;
// Create a tracker for a 3×5 output
let tracker = ArgmaxTracker::new(&[3, 5]);
// After forward pass, query the winner index for output element (1, 2)
let k_winner = tracker.winner_index(&[1, 2]);Implementations§
Source§impl ArgmaxTracker
impl ArgmaxTracker
Sourcepub fn output_shape(&self) -> &[usize]
pub fn output_shape(&self) -> &[usize]
Return the output shape.
Sourcepub fn indices_mut(&mut self) -> &mut [usize]
pub fn indices_mut(&mut self) -> &mut [usize]
Return a mutable reference to the winner indices.
Auto Trait Implementations§
impl Freeze for ArgmaxTracker
impl RefUnwindSafe for ArgmaxTracker
impl Send for ArgmaxTracker
impl Sync for ArgmaxTracker
impl Unpin for ArgmaxTracker
impl UnwindSafe for ArgmaxTracker
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