pub trait TensorSemiringCore<Alg: Semiring> {
type Plan;
type Context;
// Required methods
fn plan(
ctx: &mut Self::Context,
desc: &SemiringCoreDescriptor,
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<()>;
}Expand description
Minimal semiring execution protocol.
§Examples
ⓘ
use tenferro_algebra::Standard;
use tenferro_prims::{CpuBackend, CpuContext, SemiringCoreDescriptor, TensorSemiringCore};
let mut ctx = CpuContext::new(1);
let desc = SemiringCoreDescriptor::MakeContiguous;
let _plan = <CpuBackend as TensorSemiringCore<Standard<f64>>>::plan(
&mut ctx,
&desc,
&[&[2, 2], &[2, 2]],
)
.unwrap();Required Associated Types§
Required Methods§
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> TensorSemiringCore<Standard<S>> for CpuBackend
impl<S: Scalar> TensorSemiringCore<Standard<S>> for CpuBackend
Source§impl<S: Scalar> TensorSemiringCore<Standard<S>> for CudaBackend
Available on non-crate feature cuda only.
impl<S: Scalar> TensorSemiringCore<Standard<S>> for CudaBackend
Available on non-crate feature
cuda only.