Dynamic Inference of Likely Symbolic Tensor Shapes in Python Machine Learning Programs

Koushik Sen
International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP)(2024) (to appear)


In machine learning programs, it is often tedious to annotate the dimensions of shapes of various tensors that get created during execution. We present a dynamic likely tensor shape inference analysis that annotates the dimensions of shapes of tensor expressions with symbolic dimension values. Such annotations can be used for understanding the machine learning code written in popular frameworks, such as TensorFlow, PyTorch, JAX, and for finding bugs related to tensor shape mismatch.