A shooting formulation of deep learning