Python wrappers
Public Python APIs implemented by this engine symbol.General tensor contraction via an Einstein summation equation.
The equation uses the same syntax as NumPy's einsum: single-character
labels separated by commas for each input, optionally followed by ->
and the output labels. If -> is omitted, the output labels are the
sorted set of labels that appear exactly once across all inputs (implicit
form). Repeated labels in a single operand take the diagonal; labels
shared across operands trigger contraction; labels dropped from the output
are summed out.
Math
See Also
einops_rearrange_op, einops_reduce_op, einops_repeat_op
Parameters
patternstd::stringEinsum equation, e.g.
"ij,jk->ik" for matrix multiplication or "bij,bjk->bik" for batched matmul.operandsstd::vector<TensorImplPtr>The input tensors, one per comma-separated label group. All operands must share the same device and dtype.
Returns
TensorImplPtrContracted tensor of the shape implied by the output labels.
Raises
EinopsPatternErrorIf the equation is malformed, label counts do not match operand dimensions, or contracted dimensions disagree in size.
DeviceMismatchIf operands live on different devices.
DtypeMismatchIf operands have different dtypes.
Notes
Ellipsis (...) is not yet supported. Use explicit labels for batch
dimensions in the meantime.
Examples
"ij,jk->ik" — matrix multiplication.
"bhij,bhjk->bhik" — multi-head batched attention contraction.