This paper is dedicated to the acoustic inversion of the vertical sound speed profiles (SSPs) in the underwater marine environment. The method of automatic differentiation is applied for the first time in this context. Representing the finite-difference Padé approximation of the propagation operator as a computational graph allows for the analytical computation of the gradient with respect to the SSP directly within the numerical scheme. The availability of the gradient, along with the high computational efficiency of the numerical method used, enables rapid inversion of the SSP based on acoustic measurements from a hydrophone array. It is demonstrated that local optimization methods can be effectively used for real-time sound speed inversion. Comparative analysis with existing methods shows the significant superiority of the proposed method in terms of computation speed.