Training Deep Neural Networks and Solving Differential Equations using Neuromorphic Photonics