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§
Required Methods§
Sourcefn plan(
ctx: &mut Self::Context,
desc: &SemiringFastPathDescriptor,
shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( ctx: &mut Self::Context, desc: &SemiringFastPathDescriptor, shapes: &[&[usize]], ) -> Result<Self::Plan>
Plan an optional semiring fast path.
Sourcefn 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 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.
Sourcefn has_fast_path(desc: SemiringFastPathDescriptor) -> bool
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§
Source§impl<S: Scalar> TensorSemiringFastPath<Standard<S>> for CpuBackend
impl<S: Scalar> TensorSemiringFastPath<Standard<S>> for CpuBackend
Source§impl<S: Scalar> TensorSemiringFastPath<Standard<S>> for CudaBackend
Available on non-crate feature cuda only.
impl<S: Scalar> TensorSemiringFastPath<Standard<S>> for CudaBackend
Available on non-crate feature
cuda only.