candle_core::cpu::kernels

Trait VecOps

Source
pub trait VecOps: NumAssign + Copy {
    // Required methods
    fn min(self, rhs: Self) -> Self;
    fn max(self, rhs: Self) -> Self;

    // Provided methods
    unsafe fn vec_dot(
        lhs: *const Self,
        rhs: *const Self,
        res: *mut Self,
        len: usize,
    ) { ... }
    unsafe fn vec_reduce_sum(xs: *const Self, res: *mut Self, len: usize) { ... }
    unsafe fn vec_reduce_max(xs: *const Self, res: *mut Self, len: usize) { ... }
    unsafe fn vec_reduce_min(xs: *const Self, res: *mut Self, len: usize) { ... }
}

Required Methods§

Source

fn min(self, rhs: Self) -> Self

Source

fn max(self, rhs: Self) -> Self

Provided Methods§

Source

unsafe fn vec_dot( lhs: *const Self, rhs: *const Self, res: *mut Self, len: usize, )

Dot-product of two vectors.

§Safety

The length of lhs and rhs have to be at least len. res has to point to a valid element.

Source

unsafe fn vec_reduce_sum(xs: *const Self, res: *mut Self, len: usize)

Sum of all elements in a vector.

§Safety

The length of xs must be at least len. res has to point to a valid element.

Source

unsafe fn vec_reduce_max(xs: *const Self, res: *mut Self, len: usize)

Maximum element in a non-empty vector.

§Safety

The length of xs must be at least len and positive. res has to point to a valid element.

Source

unsafe fn vec_reduce_min(xs: *const Self, res: *mut Self, len: usize)

Minimum element in a non-empty vector.

§Safety

The length of xs must be at least len and positive. res has to point to a valid element.

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.

Implementations on Foreign Types§

Source§

impl VecOps for f32

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

unsafe fn vec_dot( lhs: *const Self, rhs: *const Self, res: *mut Self, len: usize, )

Source§

unsafe fn vec_reduce_sum(xs: *const Self, res: *mut Self, len: usize)

Source§

impl VecOps for f64

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

impl VecOps for i64

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

impl VecOps for u8

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

impl VecOps for u32

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

impl VecOps for bf16

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

impl VecOps for f16

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

unsafe fn vec_dot( lhs: *const Self, rhs: *const Self, res: *mut Self, len: usize, )

Implementors§