Learning Flow Functions from Data with Applications to Nonlinear Oscillators