Virtual reality devices featuring diffractive grating components have emerged as hotspots in the field of near-to-eye displays. The core aim of our work is to streamline the intricacies involved in devising the highly efficient slanted waveguide grating using the deep-learning-driven inverse design technique. We propose and establish a tandem neural network (TNN) comprising a generative flow-based invertible neural network and a fully connected neural network. The proposed TNN can automatically optimize the coupling efficiencies of the proposed grating at multi-wavelengths, including red, green, and blue beams at incident angles in the range of 0°-15°. The efficiency indicators manifest in the peak transmittance, average transmittance, and illuminance uniformity, reaching approximately 100%, 92%, and 98%, respectively. Additionally, the structural parameters of the grating can be deduced inversely based on the indicators within a short duration of hundreds of milliseconds to seconds using the TNN. The implementation of the inverse-engineered grating is anticipated to serve as a paradigm for simplifying and expediting the development of diverse types of waveguide gratings.