We wrote core Maxwell's Equations solvers using the HIPS autograd package, and defined custom primitives for performing backpropagation through electromagnetic simulations.
This allows one to effortlessly perform gradient-based optimization of optical devices, as well as plug electromagnetic simulations into a machine learning model.
For more details, our github repo: https://github.com/twhughes/ceviche
and arxiv preprint: https://arxiv.org/abs/1908.10507