Talks: Catching Tensor Shape Errors without Running Your Code

Saturday - April 22nd, 2023 11:30 a.m.-noon in 255ABC

Presented by:

Experience Level:

Some experience


ML developers are often slowed down by errors because of long iteration times and difficulty in debugging ML code. Tensor shape mismatches are some of the most common errors for both new and experienced ML developers, occurring when an operation is fed a multi-dimensional array (tensor) with the wrong dimensions (shape).

In this talk, we will show that it is possible to catch Tensor shape mismatches without running your code by (a) representing the symbolic shape of a tensor (e.g., H x W x B) with explicit type annotations, called shape types, and (b) using a type checker to catch mismatches. We will also show how shape types can help us understand code faster by allowing us to see the shape of a tensor variable right in the IDE. Finally, we will describe how shape types can be adopted gradually in an existing ML project, talk about support for features such as broadcasting (in NumPy, PyTorch, etc.), and walk through the limitations of this new concept of shape types.