Thank you very much. The problem is solved. The most important thing is that I can only use self.foo.fill_(some_tensor.item()), and avoid ANY using of self.foo = some_tensor. Even if I use self.foo.fill_(value) after self.foo = some_tensor, the result is incorrect. I don’t know why. Anyway, thank you very much.