pub fn einsum_owned<T: Scalar + HasAlgebra>(
_subscripts: &str,
_operands: Vec<Tensor<T>>,
) -> Result<Tensor<T>>Expand description
Execute einsum using string notation, consuming the input tensors.
Takes ownership of the operands, allowing the implementation to reuse their buffers for intermediate results or the final output. This avoids allocation when an operand buffer is already the right shape and layout.
§Examples
ⓘ
use tenferro_einsum::einsum_owned;
use tenferro_tensor::{Tensor, MemoryOrder};
let col = MemoryOrder::ColumnMajor;
let a = Tensor::<f64>::from_slice(&[1.0, 2.0, 3.0, 4.0], &[2, 2], col).unwrap();
let b = Tensor::<f64>::from_slice(&[5.0, 6.0, 7.0, 8.0], &[2, 2], col).unwrap();
// `a` and `b` are consumed; their buffers may be reused
let c = einsum_owned("ij,jk->ik", vec![a, b]).unwrap();§Errors
Returns an error if the notation is invalid or tensor shapes are incompatible with the subscripts.