Joint optimization framework of metasurface-based optics with Deep Learning systems