Hi,
Why is this non-differentiable? You don’t seem to be using non-differentiable operations?
You want to reimplement it though so that it uses torch Tensors and only torch functions so that it can use the autograd engine.