code: def test_difference_torch_odd(self):
      model = NoSharedModel()
      a = model.a.weight
      b = model.b.weight
      self.assertNotEqual(a.data_ptr(), b.data_ptr())
      torch.save(model.state_dict(), "tmp3.bin")
  
      model2 = Model()
      self.assertEqual(
          _find_shared_tensors(model2.state_dict()),
          [{"a.weight", "b.weight"}, {"b.bias", "a.bias"}],
      )
      # Torch will affect either `b` or `a` to the shared tensor in the `model2`
      model2.load_state_dict(torch.load("tmp3.bin"))
  
      # XXX: model2 uses only the B weight not the A weight anymore.
      self.assertFalse(torch.allclose(model2.a.weight, model.a.weight))
      torch.testing.assert_close(model2.a.weight, model.b.weight)
      self.assertEqual(
          _find_shared_tensors(model2.state_dict()),
          [{"a.weight", "b.weight"}, {"b.bias", "a.bias"}],
      )
  
      # Everything is saved as-is
      save_model(model, "tmp3.safetensors")
      # safetensors will yell that there were 2 tensors on disk, while
      # the models expects only 1 tensor since both are shared.
      with self.assertRaises(RuntimeError) as ctx:
          load_model(model2, "tmp3.safetensors")
      # Safetensors properly warns the user that some ke
      self.assertIn(
          """Unexpected key(s) in state_dict: "b.bias", "b.weight""",
          str(ctx.exception),
      )
  
imports: import copy
  import unittest
  import torch
  from safetensors import safe_open
  from safetensors.torch import _end_ptr, _find_shared_tensors, _is_complete, _remove_duplicate_names, load_model, save_file, save_model
label_desc: Use image node_id 13 for calling the TorchModelTestCase obj's underlying member method code with example usage: obj.test_difference_torch_odd() without return types