np.einsum() (Einstein summation) expresses sums of products over array indices using a compact subscript string.