cs.LGMay 29, 2026

Graphical einops: bridging tensor networks and computation graphs

Authors: Vincent Wang-MaścianicaNikhil Khatri

Organizations: †Laboratory for Human-Centered AI, Department of Philosophy, University of Oxford. · ‡Machine Learning Research Group, Department of Engineering Science, University of Oxford

Abstract

Architecture diagrams are ubiquitous in deep learning, but they are usually only representational: the tensor-program identities they suggest are still proved by prose and tensor-axis manipulation. We introduce a formal graphical calculus for the structural fragment of tensor programming underlying einops, making such diagrams proof-enabling. Our calculus represents tensor axes as nested graded tubes around a base type. The tube boundary recovers the undirected tensor-network view of axes, while the directed interior retains the operational reading of computation graphs. The key rewrite is grade-naturality: sliding spectacles over tubes. Standard equivariance proofs become short diagrammatic derivations. We additionally demonstrate how our rewrite system may be applied to convert attention masks into pre-processing operations, recovering efficient implementations of sparse attention blocks.

Explore similar work

CardsList
  1. It's All Just Vectorization: einx, a Universal Notation for Tensor Operations

    Jul 30, 2026Florian Fervers, Sebastian Bullinger, Christoph Bodensteiner +1Tensor ProgramsHigher Order

  2. Tensor Cookbook: Mastering Tensors through Diagrams

    May 15, 2026Beheshteh T. Rakhshan, Guillaume RabusseauTensor NetworksTensor