Intelligent Nanophotonics