I need to monitor the gradients in real time during training when using fit
or fit_generator
methods. This should have been achieved by using custom callback
function. However, I don't how to access the gradients correctly. The attribute model.optimizer.update
returns tensors of gradients but it need to be fed with data. What I want to get is the value of gradients that have been applied in the last batch during training.
The following answer does not give the corresponding solution because it just define a function to calculate the gradients by feeding extra data.