I don’t see any obvious issues in your code, but as it’s not executable I also cannot verify its functionality.
You could check if all the expected parameters in your model receive a valid gradient by checking the .grad attribute before and after calling the first backward() operation. Once this is done you could then check their values or magnitude and see if they might be really small and thus almost no change would be visible.