You’re querying python objects, and these are basically created for everything. List indexing is a built-in operation that avoids object creation or copying, so it is a bit special. And tensors are wrappers, sliced with code in __getitem__.
The stable thing is the memory address of tensor’s storage (that’s technically a number exported from c++ part): a.storage().data_ptr()