The use of cascaded neural networks for the reverse design of metamaterials and nanophotons can effectively alleviate the problems caused by one-to-many mapping, but the intermediate layer of the cascaded network is unsupervised learning, and an effective method is needed to limit output range of the intermediate layer.