pub trait SemiringBackend<Alg: Semiring> {
// Required method
fn batched_gemm(
&mut self,
lhs: &TypedTensor<Alg::Scalar>,
rhs: &TypedTensor<Alg::Scalar>,
config: &DotGeneralConfig,
) -> Result<TypedTensor<Alg::Scalar>>;
// Provided methods
fn add(
&mut self,
lhs: &TypedTensor<Alg::Scalar>,
rhs: &TypedTensor<Alg::Scalar>,
) -> Result<TypedTensor<Alg::Scalar>> { ... }
fn mul(
&mut self,
lhs: &TypedTensor<Alg::Scalar>,
rhs: &TypedTensor<Alg::Scalar>,
) -> Result<TypedTensor<Alg::Scalar>> { ... }
fn reduce_sum(
&mut self,
input: &TypedTensor<Alg::Scalar>,
axes: &[usize],
) -> Result<TypedTensor<Alg::Scalar>> { ... }
}Expand description
Algebra-generic backend over typed tensors.
§Examples
ⓘ
use tenferro_algebra::Standard;
use tenferro_tensor::{cpu::CpuBackend, SemiringBackend};
fn needs_semiring_backend<B: SemiringBackend<Standard<f64>>>(_backend: &mut B) {}
let mut backend = CpuBackend::new();
needs_semiring_backend(&mut backend);