rasbt:

compute gradients
partial_derivatives = grad(layer_cost, (model.your_layer.weights, 
                                        model.your_layer.bias))



Hi, @rasbt.
Recently, I try to implement my model based on your suggestions. And I encount the problem of computing gradients.
Specifically, in tensorflow, one can use the optimizer.compute_gradients() to get parameters’ gradients. However, in pytorch, I found that there is no such a function or module that can be used to compute the gradients of my own loss function.
So, do you have any hint?
Thank you in advance.