On Tensors
summary
Current tensor libraries leak low-level flat-memory semantics so reshape and broadcasting rules quietly produce wrong results; the claim is that naming dimensions fixes most surprises and makes shape intent explicit. The talk demonstrates a small DSL that lowers named shapes to library indices, plus a runtime checker called Stanley that flags mismatched shapes, and a lightweight named-dimension library (referred to as TS a lip library) that implements explicit broadcasts and concise transforms. The code examples compile to real NumPy/PyTorch ops and work end to end.
AI-written summary · about
chapters (21)
- 0:00Intro
- 1:10A New Style of Programming
- 2:07Key Ingredients of Software 2.0 Design
- 5:05Tensor Representations: Physical Layer
- 7:36A. Exposure to Low-level Memory Model API tied to physical, indexed layout. No semantic notion of axis
- 8:53B. Adhoc Broadcast Semantics
- 10:43C. Hard to read / write Tensor manipulating code
- 11:54Cryptic Shape Transformations
- 12:16Tensor Representations: 10ft - 1e10 ft
- 13:54Proposals for Naming Tensor Dimensions Ideas for array shape typing in Python Annotations #4164
- 15:12tsalib: A Tensor Shape Annotation Library
- 16:00Resnet.forward (original)
- 19:40Named Dimensions -- Grammar of Named Shapes
- 20:55From Transformer Attention Module (old vs new)
- 21:38Rewriting BERT with warp
- 22:39tsalib: Lowering Named Shape Transformations
- 24:00Two Issues
- 24:14Tsanley: dynamic shape checking annotation
- 25:35Tsanley: dynamic shape checking • Interplay of AST parsing, Python tracing (trace, inspect)
- 25:45Open Source Research @OffNote Labs
- 26:52Summary: Befriending Tensors • Disconnect between memory model of tensor libraries and developer's semantic model
related talks
27mCatching Tensor Shape Errors without Running Your Code
01h 02mThe Shapes of Multi-Dimensional Arrays
11mPyTorch 2.0: Dynamic Shapes Support
33mTeIL: a type-safe imperative Tensor Intermediate Language
08mPyTorch Front-End Features: Named Tensors and Type Promotion
45mTensorly: A Flexible Python Framework for Machine Learning
35mTowards Typesafe Deep Learning in Scala
04mInterview
