Could you print the gradients directly from the self.lin layer?
If the computation graph is detached somewhere (which I cannot see in your code, as it looks fine), you shouldn’t be able to see any values in print(model.lin.weight.grad) but it should instead print a None value.