How to add autodiff like Halide? https://people.csail.mit.edu/tzumao/gradient_halide/gradient_halide.pdf