pub trait TensordotOps: AsView {
// Required method
fn tensordot(
&self,
b: &impl AsView<Repr = Self::Repr>,
axes: TensorDotAxes<'_>,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as Repr>::Value>;
}Expand description
Tensordot of two concrete inputs that implement AsView with one representation; the result has that representation.
Generated by api_ops! from the einsum registry.
Required Methods§
Sourcefn tensordot(
&self,
b: &impl AsView<Repr = Self::Repr>,
axes: TensorDotAxes<'_>,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as Repr>::Value>
fn tensordot( &self, b: &impl AsView<Repr = Self::Repr>, axes: TensorDotAxes<'_>, exec: &mut dyn Engine, ) -> Result<<Self::Repr as Repr>::Value>
Contract a with b over the given axis pairs (or the last/first n axes); free axes of a come first.
This operation has no options.
§Layout
Lowered to one dot_general, which reads strided operands in place; an operand that the provider cannot read is packed once into a compact buffer of the same placement and dtype.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): tensordot is unsupported in a lane
§Examples
use tenferro_cpu::CpuEngine;
use tenferro_einsum::{TensorDotAxes, TensordotOps};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let a = Tensor::from_vec_col_major(vec![2, 3], vec![1.0_f64; 6])?;
let b = Tensor::from_vec_col_major(vec![3, 4], vec![1.0_f64; 12])?;
let c = a.tensordot(&b, TensorDotAxes::Count(1), &mut engine)?;
assert_eq!(c.shape(), &[2, 4]);
assert_eq!(c.as_slice::<f64>()?, &[3.0; 8]);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".