I’m not sure which parameters should get gradients but don’t so could you explain the issue a bit more?
PS: you can post code snippets by wrapping them into three backticks ``` which allows to debug the code easier 
Based on the linked code you have to check if you are (accidentally) detaching the tensors form the computation graph vi:

using numpy (Autograd won’t be able to track these operations so you should use PyTorch methods instead. If that’s not possible, write a custom autograd.Function as described here)
rewrapping tensors via x = torch.tensor(x) where x was a tensor attached to a graph
using non-differentiable functions such as torch.argmax