Skip to main content

Argmax

Trait Argmax 

Source
pub trait Argmax<T> {
    // Required methods
    fn argmax_write<Lx: Layout, S: Shape>(
        &self,
        x: &Slice<T, S, Lx>,
        output: &mut Vec<usize>,
    ) -> bool;
    fn argmax_abs_write<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 of any rank.

Implementations define the ordering and magnitude semantics they support for T; backend impl bounds should state any Rust scalar traits they rely on.

Required Methods§

Source

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

Source

fn argmax_abs_write<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".

Implementors§

Source§

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