Detecting protocol violations in deep learning programs using typestate and value propagation analysis