  The propagation of ultrashort pulses in optical fibre displays complex
nonlinear dynamics that find important applications in fields such as high
power pulse compression and broadband supercontinuum generation. Such nonlinear
evolution however, depends sensitively on both the input pulse and fibre
characteristics, and optimizing propagation for application purposes requires
extensive numerical simulations based on generalizations of a nonlinear
Schr\"odinger-type equation. This is computationally-demanding and creates a
severe bottleneck in using numerical techniques to design and optimize
experiments in real-time. Here, we present a solution to this problem using a
machine-learning based paradigm to predict complex nonlinear propagation in
optical fibres with a recurrent neural network, bypassing the need for direct
numerical solution of a governing propagation model. Specifically, we show how
a recurrent neural network with long short-term memory accurately predicts the
temporal and spectral evolution of higher-order soliton compression and
supercontinuum generation, solely from a given transform-limited input pulse
intensity profile. Comparison with experiments for the case of soliton
compression shows remarkable agreement in both temporal and spectral domains.
In optics, our results apply readily to the optimization of pulse compression
and broadband light sources, and more generally in physics, they open up new
perspectives for studies in all nonlinear Schr\"odinger-type systems in studies
of Bose-Einstein condensates, plasma physics, and hydrodynamics.
