This is the question about Autograd and Pytorch’s gradient management system.


Basically, my neural network is like the encoder part of VAE - it gets images as its input, and returns a vector R.


With R, compute loss function L= SomeLossFunction( R ).


After performing L.backward(), R will have its own gradient. I mean, there must be something like R.grad.


What I want to do : adjust the R.grad manually, and re-compute all the gradient of all the weight parameters in NN according to this adjusted gradient.


Is this computation possible without fixing autograd system too much?