Skip to main content

ComputeFor

Trait ComputeFor 

Source
pub trait ComputeFor<B: Backend>: Dtype {
    // Required methods
    fn compute(
        op: &OpKind<Self>,
        output_buffer: Vec<Self>,
        output_layout: &Layout,
        inputs: &[TensorData<Self>],
    ) -> TensorData<Self>;
    fn compute_inplace(
        op: &OpKind<Self>,
        output_layout: &Layout,
        inputs: Vec<TensorData<Self>>,
        output_idx: usize,
    ) -> TensorData<Self>;
}
Expand description

Per-(T, B) compute dispatch. Splitting kernels across this trait lets each dtype specialize independently without trait-coherence conflicts; the Backend methods delegate here.

Required Methods§

Source

fn compute( op: &OpKind<Self>, output_buffer: Vec<Self>, output_layout: &Layout, inputs: &[TensorData<Self>], ) -> TensorData<Self>

Source

fn compute_inplace( op: &OpKind<Self>, output_layout: &Layout, inputs: Vec<TensorData<Self>>, output_idx: usize, ) -> TensorData<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ComputeFor<CpuPure> for f32

Source§

fn compute( op: &OpKind<f32>, output_buffer: Vec<f32>, output_layout: &Layout, inputs: &[TensorData<f32>], ) -> TensorData<f32>

Source§

fn compute_inplace( op: &OpKind<Self>, output_layout: &Layout, inputs: Vec<TensorData<Self>>, output_idx: usize, ) -> TensorData<Self>

Source§

impl ComputeFor<CpuPure> for f64

Source§

fn compute( op: &OpKind<f64>, output_buffer: Vec<f64>, output_layout: &Layout, inputs: &[TensorData<f64>], ) -> TensorData<f64>

Source§

fn compute_inplace( op: &OpKind<Self>, output_layout: &Layout, inputs: Vec<TensorData<Self>>, output_idx: usize, ) -> TensorData<Self>

Implementors§