I found that defining a tensor variable and change its value in a function, outer the function the tensor’s value will change though I did not return anything. So what does happen when I did things above?
from torch import Tensor
a = Tensor([0])
>>> a = tensor(0.)
def b(t):
    t[0]=3
b(a)
print(a)
>>> a=tensor(3.)

It’s may about the scope of a tensor or torch low-level method. However I want someone can give me a complete reason to explain it.