x = torch.rand(3)
print(id(x))  # 140252375853408
x = torch.rand(3)
print(id(x))  # 140252189803616

x = torch.rand(3)
print(id(x))  # 140252375853408
x[:] = torch.rand(3)
print(id(x))  # 140252375853408

See, [:] would not change the memory address.