Say I create a placeholder for a batch of 3 images -
batch = torch.zeros(3, 3, 256, 256, dtype=torch.uint8)

I have my dummy image -
image = torch.randint(size = (3,256,256), low=0, high=256)

I then do -
batch[0] = image

I am unable to understand the following outputs - 




          id(batch[0]) == id(image)
          out: False

Should this not be true as both hold references to the same Tensor object ‘image’?




          id(batch.storage()) == id(image.storage())
          out: True
        
          batch[0][0][0][0] = 5
          print(image[0][0][0])
          out: 171


Since both ‘batch’ and ‘image’ share the same underlying storage, why does the change in batch[0][0][0][0] not reflect when I print the corresponding element of ‘image’ ?
Thank you!