In-place operation on chunked tensor does not increase tensor version

Hi All!

I observed something in Pytorch that I think is not right. According to https://pytorch.org/docs/stable/notes/autograd.html
after any change in the values of a tensor its version counter should increase. That is needed so the autograd engine can check the correctness of calculating the gradients as stated in the link.

However, I am confused why Pytorch is not increasing the version number of the x tensor in this snippet:

import torch
x = torch.randn(100)
print('x sum before manipulation', torch.sum(x))
print('x version before manipulation', x._version)
z1, z2 = torch.chunk(x, 2)
print('z1 version after manipulation', z1._version)
z1 /= 10 # an inplace operation, note that z1 = z1/10 is not inplace so it should be z1 /= 10 here to show the problem
print('x sum after manipulation', torch.sum(x))
print('x version after manipulation', x._version)
print('z1 version after manipulation', z1._version)

a test run results in:

x sum before manipulation tensor(14.4694)
x version before manipulation 0
z1 version after manipulation 0
x sum after manipulation tensor(15.3440)
x version after manipulation 0
z1 version after manipulation 1

However, I think the x’s version should also increase in this situation as the content of it is changed.

I also have this code in Colab if you want to test it yourself here

I am wondering if it is a bug.