TensorSemiringFastPath

Trait TensorSemiringFastPath 

Source
pub trait TensorSemiringFastPath<Alg: Semiring> {
    type Plan;
    type Context;

    // Required methods
    fn plan(
        ctx: &mut Self::Context,
        desc: &SemiringFastPathDescriptor,
        shapes: &[&[usize]],
    ) -> Result<Self::Plan>;
    fn execute(
        ctx: &mut Self::Context,
        plan: &Self::Plan,
        alpha: Alg::Scalar,
        inputs: &[&Tensor<Alg::Scalar>],
        beta: Alg::Scalar,
        output: &mut Tensor<Alg::Scalar>,
    ) -> Result<()>;
    fn has_fast_path(desc: SemiringFastPathDescriptor) -> bool;
}
Expand description

Optional semiring performance paths.

§Examples

use tenferro_algebra::Standard;
use tenferro_prims::{
    CpuBackend, SemiringBinaryOp, SemiringFastPathDescriptor, TensorSemiringFastPath,
};

let supported =
    <CpuBackend as TensorSemiringFastPath<Standard<f64>>>::has_fast_path(SemiringFastPathDescriptor::ElementwiseBinary {
        op: SemiringBinaryOp::Mul,
    });
assert!(supported);

Required Associated Types§

Source

type Plan

Backend-specific plan type.

Source

type Context

Backend-specific execution context.

Required Methods§

Source

fn plan( ctx: &mut Self::Context, desc: &SemiringFastPathDescriptor, shapes: &[&[usize]], ) -> Result<Self::Plan>

Plan an optional semiring fast path.

Source

fn execute( ctx: &mut Self::Context, plan: &Self::Plan, alpha: Alg::Scalar, inputs: &[&Tensor<Alg::Scalar>], beta: Alg::Scalar, output: &mut Tensor<Alg::Scalar>, ) -> Result<()>

Execute an optional semiring fast path.

Source

fn has_fast_path(desc: SemiringFastPathDescriptor) -> bool

Query whether the optional path is available.

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§