Gradual Tensor Shape Checking

03/16/2022
by   Momoko Hattori, et al.
0

Tensor shape mismatch is a common source of bugs in deep learning programs. Most of the studies conducted to solve this problem use the whole-program analysis approach, which lacks compositionality. A type-based approach is desirable in this respect, but since the problem of shape inference is undecidable in general, fully automated shape inference is bound to be either unsound or too conservative. We propose a type-based approach to detect tensor shape mismatches that works practically under such limitations. One of the main features of our approach is the best-effort shape inference. Because of the undecidability of shape inference, our procedure performs it only in a best-effort manner. The inference result may be too imprecise to statically guarantee the absence of the shape inconsistencies, and in such cases, dynamic checks are inserted into the program. Another main feature is gradual typing. Users can improve the precision of the inference by adding appropriate type annotations to the program. We formalize our approach and prove that it satisfies the criteria of gradual typing proposed by Siek et al. in 2015. We implement a prototype shape checking tool based on our approach and evaluate its effectiveness by applying it to some deep neural network programs.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
12/16/2021

A Static Analyzer for Detecting Tensor Shape Errors in Deep Neural Network Training Code

We present an automatic static analyzer PyTea that detects tensor-shape ...
research
10/05/2022

Axon: A Language for Dynamic Shapes in Deep Learning Graphs

Axon is a language that enables shape and rank inference for tensors in ...
research
11/13/2017

A Type Checking Algorithm for Higher-rank, Impredicative and Second-order Types

We study a type checking algorithm that is able to type check a nontrivi...
research
08/01/2018

Using Standard Typing Algorithms Incrementally

Modern languages are equipped with static type checking/inference that h...
research
07/12/2023

Sound One-Phase Shape Analysis with Biabduction

Biabduction-based shape analysis is a static analysis technique that can...
research
11/26/2020

ShapeFlow: Dynamic Shape Interpreter for TensorFlow

We present ShapeFlow, a dynamic abstract interpreter for TensorFlow whic...
research
11/16/2015

Deep Learning for steganalysis is better than a Rich Model with an Ensemble Classifier, and is natively robust to the cover source-mismatch

Since the BOSS competition, in 2010, most steganalysis approaches use a ...

Please sign up or login with your details

Forgot password? Click here to reset