Abstract:A physics-informed neural network (PINN) that combines deep learning with physics is studied to solve the nonlinear Schr\"odinger equation for learning nonlinear dynamics in fiber optics. We carry out a systematic investigation and comprehensive verification on PINN for multiple physical effects in optical fibers, including dispersion, self-phase modulation, and higher-order nonlinear effects. Moreover, both special case (soliton propagation) and general case (multi-pulse propagation) are investigated and realized with PINN. In the previous studies, the PINN was mainly effective for single scenario. To overcome this problem, the physical parameters (pulse peak power and amplitudes of sub-pulses) are hereby embedded as additional input parameter controllers, which allow PINN to learn the physical constraints of different scenarios and perform good generalizability. Furthermore, PINN exhibits better performance than the data-driven neural network using much less data, and its computational complexity (in terms of number of multiplications) is much lower than that of the split-step Fourier method. The results report here show that the PINN is not only an effective partial differential equation solver, but also a prospective technique to advance the scientific computing and automatic modeling in fiber optics.