Hi,
If you use .item(), no gradient will flow back on that side.
This “works” because you later add that python number with a Tensor that requires grad which gives you a final los which is a Tensor that requires grad.
But no the gradient won’t flow back towards the python numbers!