Hello, thank you for replying. I am using detach because I was getting this error:
RuntimeError: the derivative for 'target' is not implemented

And looking for a solution I found detach(). As you say, loss1 and loss2 are constant and only loss3 starts to go down.