Macro numpy::einsum [−][src]
Return the Einstein summation convention of given tensors.
For more about the Einstein summation convention, you may reffer to the numpy document.
Example
pyo3::Python::with_gil(|py| { let a = numpy::PyArray::arange(py, 0, 2 * 3 * 4, 1).reshape([2, 3, 4]).unwrap(); let b = numpy::pyarray![py, [20, 30], [40, 50], [60, 70]]; let einsum = numpy::einsum!("ijk,ji->ik", a, b).unwrap(); assert_eq!( einsum.readonly().as_array(), ndarray::array![[640, 760, 880, 1000], [2560, 2710, 2860, 3010]] ); });