I think this issue is somewhat unrelated to copying/references. In my examples, I am always comparing within a dictionary.
The question I’m asking is: what is a way to make a copy while still having resultant tensors that share the same data_ptrs (within the copy)?
For what it’s worth, I know that copy.deepcopy handles this correctly. However, I do not know of a solution that works when I need to move the state_dict across devices (other than moving the whole model to a different device first).