We use a supervised machine-learning model based on a neural network to predict the temporal and spectral intensity profiles of the pulses that form upon nonlinear propagation in optical fibers with both normal and anomalous second-order dispersion. We also show that the model is able to retrieve the parameters of the nonlinear propagation from the pulses observed at the output of the fiber. Various initial pulse shapes as well as initially chirped pulses are investigated.