A deep learning model is proposed to realize the topological design of 2D periodic structures for anti-plane waves. The influence of site conditions, namely soil parameters, on the design, is considered. The model is composed of a variational autoencoder (VAE) and an autoencoder (AE) with a pretrained decoder. Two types of datasets, Image Dataset and Physics Dataset, are used to train the VAE and the AE’s decoder, respectively. A large number of numerical simulations are performed to prove the reliability of the deep learning model designing topological configurations, and the correlation coefficient between the targeted and designed bandgaps reaches 0.998. Designs under different site conditions from soft soil to hard soil are realized satisfactorily by the proposed model, and multiple topological configurations are given for the same target under the same site condition, revealing the “one-to-many” nature of the design problem. The results show that the proposed deep learning model is smart, efficient, precise, stable, and universal.