Thank for your kind advice!
I checked the result changing the in-place operation to loss = loss + ~, but the result is same (same myloss). The critical problem is that the layer gets same parameters in every training process.
But of course, my goal is to make myloss correctly.