According to the python documentation: All none keyword arguments are converted to strings using str(). This mean that the print() can’t be trusted. What’s happening in the example below might be the reason for your results.
a = 5
b = "5"
print(a is b)
print(a)
print(b)

Output:
False
5
5

In other words, there is a string conversion happening in the print() function that might be the source for the confusion. If you have a debugger, add a break point and have a look in  the variable explorer to see if there’s any difference.
Edit:
Try adding this to your code when checking
print(y.data_ptr(),type(y.data_ptr()))
print(y.grad_fn._saved_result.data_ptr(),type(y.grad_fn._saved_result.data_ptr()))

Then you’ll get more information in the printout that might convey the mystery