Einsum
Description
Uses the Einstein sum convention to evaluate the algebraic tensor operation on the tensor sequence. Format: term1, term2-> y_term. The formula string contains a sequence of lowercase letters separated by commas (,). Each item corresponds to an operand tensor, and the characters in the item correspond to the operand dimension.

Input
x: input tensor of type float16 or float. Non-contiguous tensors are supported, but empty tensors are not supported. The data format supports ND. The number of input tensors ranges from 1 to 2147483647.
Attribute
equation: subscript of Einstein summation, which is a summation expression string.
Output:
y: tensor of type float16, int32, or float. Non-contiguous tensors are supported. Empty tensors are not supported. The data format can be ND.
Constraints
Currently, ONNX Einsum supports only 20 dual-input cases:
For example, in abc,cde->abde, abc indicates the three dimensions of the first tensor, cde indicates the three dimensions of the second tensor, and abde indicates the output tensor dimension, which is obtained during calculation. In the example, Einsum sums up along the shared dimension c. That means that the c dimension appears in both tensors. Einsum performs the sum operation on this dimension, and other dimensions (a, b, d, and e) are retained.
"abc,cde->abde","abc,cde->abde","abcd,aecd->aceb","abcd,adbe->acbe","abcd,cde->abe","abc,cd->abd","abc,dc->abd","abc,abd->dc","abc,dec->abde","abc,abde->dec","abcd,aecd->acbe","abcd,acbe->aecd","abcd,ecd->abe","abcd,abe->ecd","abcd,acbe->adbe","abcd,abde->abce","abcd,abce->abde","abcd,aebd->aebc","abcd,abce->acde","abc,abd->acd","ab,cb->ac".
ONNX Opset Support
Supported ONNX version Opset v12/v13/v14/v15/v16/v17/v18