You could print the gradient norm or sum after calling loss.backward() to check, the magnitude etc. and more importantly, if gradients are calculated at all or if somehow the computation graph was detached.
loss.backward()
print(model.layer.weight.grad.norm())