pub trait TropicalWithArgmax: TropicalSemiring {
type Index: Copy + Default + Debug + Send + Sync + 'static;
// Required method
fn tropical_add_argmax(
self,
self_idx: Self::Index,
rhs: Self,
rhs_idx: Self::Index,
) -> (Self, Self::Index);
}Expand description
Extension trait for tropical types that support argmax tracking.
This is used for backpropagation: during matrix multiplication, we track which k index produced the optimal value for each C[i,j].
Required Associated Types§
Required Methods§
Sourcefn tropical_add_argmax(
self,
self_idx: Self::Index,
rhs: Self,
rhs_idx: Self::Index,
) -> (Self, Self::Index)
fn tropical_add_argmax( self, self_idx: Self::Index, rhs: Self, rhs_idx: Self::Index, ) -> (Self, Self::Index)
Tropical addition with argmax tracking.
Returns the result of tropical_add along with the index
corresponding to which operand “won” (produced the result).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.