Thank you for the library! But I don’t think it solves my problem, as I want to update the gradient before the optimizer step with:
out = net(img_ano.data())
img_ano.grad = img_ano.grad + out

This does not seem possible in the library as you need to send the loss function with the gradient step (optim.loss(loss_function)) and in my case I want to change the gradient I get after gfunc.backward(). Any suggestions?