Einsum Calculator
Interactive einsum notation calculator for NumPy and PyTorch. Enter your einsum expression and tensor shapes to see the output shape, operation description, and equivalent code.
Built by Michael Lip
Frequently Asked Questions
What is einsum notation?
Einstein summation notation is a compact way to express tensor operations. 'ij,jk->ik' means matrix multiplication. Each letter represents a dimension; repeated letters are summed over (contracted). It can express dot products, outer products, transposes, traces, and more.
How do I read einsum expressions?
Left side of '->' lists input dimensions (comma-separated for multiple inputs). Right side lists output dimensions. Any letter on the left but not on the right is summed over. 'ij,jk->ik': i,j from first input; j,k from second; j is summed out; output is i,k.
Is einsum slower than dedicated operations?
Modern frameworks optimize einsum to call the same underlying BLAS routines. For common operations (matmul, dot), there's no speed difference. For complex multi-operand expressions, einsum may be slightly slower but much more readable.
About This Tool
This tool is part of HeyTensor, a free suite of PyTorch and deep learning utilities. All calculations run entirely in your browser — no data is sent to any server. The source code is open on GitHub.
Contact
HeyTensor is built and maintained by Michael Lip. For questions or feedback, email [email protected].