Argmax

Trait Argmax 

Source
pub trait Argmax<T: ComplexFloat + PartialOrd> {
    // Required methods
    fn argmax_overwrite<Lx: Layout, S: Shape>(
        &self,
        x: &Slice<T, S, Lx>,
        output: &mut Vec<usize>,
    ) -> bool;
    fn argmax_abs_overwrite<Lx: Layout, S: Shape>(
        &self,
        x: &Slice<T, S, Lx>,
        output: &mut Vec<usize>,
    ) -> bool;
    fn argmax<Lx: Layout, S: Shape>(
        &self,
        x: &Slice<T, S, Lx>,
    ) -> Option<Vec<usize>>;
    fn argmax_abs<Lx: Layout, S: Shape>(
        &self,
        x: &Slice<T, S, Lx>,
    ) -> Option<Vec<usize>>;
}
Expand description

Argmax for tensors, unlike other traits: it requires T: PartialOrd and works on tensor of any rank.

Required Methods§

Source

fn argmax_overwrite<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, output: &mut Vec<usize>, ) -> bool

Source

fn argmax_abs_overwrite<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, output: &mut Vec<usize>, ) -> bool

Source

fn argmax<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, ) -> Option<Vec<usize>>

Index of max xᵢ (argmaxᵢ xᵢ)

Source

fn argmax_abs<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, ) -> Option<Vec<usize>>

Index of max |xᵢ| (argmaxᵢ |xᵢ|)

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.

Implementors§

Source§

impl<T: ComplexFloat<Real = T> + 'static + PartialOrd + Add<Output = T> + Mul<Output = T> + Zero + Copy> Argmax<T> for Naive