Generalization bounds for neural ordinary differential equations and deep residual networks