Optimizing Neural Networks via Koopman Operator Theory