Gradient methods for the optimization of dynamical systems containing neural networks | Synapse