The Mori-Zwanzig formulation of deep learning