It Is Not That Simple: Explaining Tensor Reshapes Before They Run
The tensorplain contributors · tensorplain 0.1.0, MIT · the guesser's figures are computed on this page; the einops comparison was run when the library was built and ships in check/ to run again
1Summary
tensorplain reshapes tensors with einops-style patterns and states, before any data moves, what each pattern does: which axes are split, reduced, repeated, reordered and merged, and how large the result is. On 3,000 random patterns it gave the same shapes and values as the einops package. Its layout guesser named 36 of 40 held-out shapes correctly; every miss was a clip of frames read as a batch.
2Background
On 8 October 2026 TechCrunch reported that interview clips of a film actor and director explaining AI had gone viral [2]. In one, he described convolutional networks as precursors to transformers and a tensor as the numerical form of an image, with values for batch number, frame number and the red, green and blue of each pixel, and asked, "It's just that simple, right?"; the article's writer answered that it is not that simple. In another he described fine-tuning open-source models on a dataset he had shot himself [2].
Not connected. tensorplain, this site and $TENSOR have no connection with that person, his company, TechCrunch or any studio or AI company, and none of them has seen this note. No person is named or shown on the coin.
3The pattern language
A pattern names the input axes on the left and the output axes on the right. Parentheses group several elementary axes into one tensor axis, so (h p1) splits height into blocks of p1; () or 1 is an axis of size one; ... stands for any number of axes. Names missing on the right are reduced; names new on the right are repeated. These are the einops conventions [3].
4Explaining a plan
Every pattern is first turned into a plan: the size of every elementary axis (at most one unknown per group), the splits, the reductions, the order, the merges. The plan is checked against the shape and stated in words; errors are phrased in the pattern's terms ("axis 2 is 6, which 4 does not divide"). The data moves only after that, by one strided gather. trace inverts the plan for any output position.
5Checking against einops
3,000 patterns were generated at random — rearrange, reduce and repeat, one to six named axes, random groupings on both sides, unit axes in 436 and ellipses in 595 — and run through the einops package (version 0.8.2, numpy backend) and through tensorplain on the same 0, 1, 2, … input. All shapes and all values were equal. The first run found an error: a bare ... on the right merged its axes instead of keeping them separate; it was fixed before release and the run was repeated.
6Guessing layouts
| Set | Shapes | Right | Said sure | Sure and right |
|---|
The rules were written against the development shapes; the held-out shapes were written first and scored once. The four misses (…) are clips of frames; a shape cannot tell frames from a batch, and the guesser says so in its answer. With {video: true} all four come out right.
7Limitations
Tensors are plain arrays in this page: this is a tool for understanding and for small data, not for training. The guesser knows image and video layouts only, and the same people wrote its rules and both sets of shapes. Patterns are the einops subset most people use; einops' backends, layers and einsum are out of scope.
8Use
Explain the pattern, read the result shape, trace one value by hand, then run it. It is rarely just that simple; it can be made plain.
RReferences
- tensorplain 0.1.0, the library on this page (MIT).
- S. Perez, TechCrunch, 8 October 2026: interview clips of a film actor and director explaining AI go viral. techcrunch.com
- A. Rogozhnikov, "Einops: Clear and Reliable Tensor Manipulations with Einstein-like Notation", ICLR 2022.