Could you wrap the code into a torch.no_grad() block:
with torch.no_grad():
    for p in net.parameters():
        p,sub_(...

Make sure to call .clone() on the parameters, if you want to store them for debugging.
Otherwise you’ll store the reference, which will not show any changes in the parameter’s value.