Ok, So if you consider that I_w is a constant and has the right value, and you just want to make I_s get closer. Then you can detach I_w indeed.
But be aware that changes to I_s will actually impact I_w (even though you hide it to the autograd) and that can hinder the convergence.