pub fn einsum_native_tensors_owned(
operands: Vec<(Tensor, Vec<usize>)>,
output_ids: &[usize],
) -> Result<Tensor>Expand description
Execute a cached einsum over owned native tensors.
This is the consuming bridge used by higher-level owned contraction APIs. Inputs are promoted to a common dtype before tenferro evaluates the contraction. Repeated calls with the same equation and shapes reuse tenferro’s process-global contraction path cache.
§Arguments
operands- Native tensors paired with numeric einsum labels for each axis.output_ids- Numeric labels to keep in the result, in output axis order.
§Returns
The contracted native tensor in the promoted common dtype.
§Errors
Returns an error if the operand list is empty, any label list length does not match its tensor rank, label generation exceeds the supported range, or the backend contraction fails.
§Examples
use tensor4all_tensorbackend::einsum_native_tensors_owned;
use tenferro::Tensor as NativeTensor;
let lhs = NativeTensor::from_vec(vec![2, 3], vec![1.0_f64; 6]);
let rhs = NativeTensor::from_vec(vec![3, 2], vec![1.0_f64; 6]);
let result = einsum_native_tensors_owned(vec![(lhs, vec![0, 1]), (rhs, vec![1, 2])], &[0, 2]).unwrap();
assert_eq!(result.shape(), &[2, 2]);
assert_eq!(result.as_slice::<f64>().unwrap(), &[3.0, 3.0, 3.0, 3.0]);