Einops is a widely loved open-source Python library that makes tensor operations readable: reshaping, transposing, repeating and reducing arrays are written as short, self-documenting patterns instead of chains of view, transpose and squeeze calls. Published on GitHub under the MIT license, it has earned more than 9,600 stars and was still actively maintained in 2026.
The library provides a small set of operations โ rearrange, reduce, repeat and the einops.layers modules โ that work the same way across PyTorch, TensorFlow, JAX, NumPy, CuPy, MLX and other array frameworks. Because the notation names each axis explicitly, code written with einops documents itself and is far less prone to silent shape bugs. It has become a standard ingredient in transformer and diffusion codebases, where attention heads, patches and channels are constantly being split and merged. The patterns also serve as executable documentation of tensor shapes: a reader can see exactly which dimensions are combined, repeated or reduced without mentally simulating index arithmetic, and einops validates the pattern against the actual tensor at runtime, catching mismatches early with a readable error.
Einops is completely free and open source under the MIT license, installable from PyPI with pip.
The project also maintains extensive tutorials, and its operations are a staple of modern deep-learning codebases โ many practitioners first meet einops when reading a transformer implementation, where it has effectively become part of the shared vocabulary for describing tensor shapes.
It is for deep learning engineers, researchers and students who write tensor-heavy code โ especially transformers, vision models and diffusion pipelines โ and want shape manipulations they can read, review and trust at a glance.