Skip to main content

contract

Function contract 

Source
pub fn contract<'a>(
    ctx: &'a AtomArena<'a>,
    a: &Tensor<'a>,
    b: &Tensor<'a>,
) -> Contracted<'a>
Expand description

Contract two tensors by summing over shared dummy indices.

Two slots with the same label but opposite variance contract. The result keeps the surviving free slots in the order (a.free..., b.free...). Returns Contracted::Scalar when no free slots survive.