docstr: Test that modifications made to a class instance in TorchScript
  are visible in eager.
docstr_tok: ["Test","that","modifications","made","to","a","class","instance","in","TorchScript","are","visible","in","eager","."]
code: def test_reference_semantics(self):
      """
      Test that modifications made to a class instance in TorchScript
      are visible in eager.
      """
  
      class Foo:
          def __init__(self, a: int):
              self.a = a
  
          def set_a(self, value: int):
              self.a = value
  
          def get_a(self) -> int:
              return self.a
  
          @property
          def attr(self):
              return self.a
  
      make_global(Foo)  # see [local resolution in python]
  
      def test_fn(obj: Foo):
          obj.set_a(2)
  
      scripted_fn = torch.jit.script(test_fn)
      obj = torch.jit.script(Foo(1))
      self.assertEqual(obj.get_a(), 1)
      self.assertEqual(obj.attr, 1)
  
      scripted_fn(obj)
  
      self.assertEqual(obj.get_a(), 2)
      self.assertEqual(obj.attr, 2)
  
imports: import io
  import os
  import sys
  import unittest
  import torch
  import torch.nn
  from torch.testing import FileCheck
  from typing import Any
  from torch.testing._internal.jit_utils import JitTestCase, make_global
  import torch.testing._internal.jit_utils
  from torch.testing._internal.common_utils import IS_SANDCASTLE, skipIfTorchDynamo
  from typing import List, Tuple, Iterable, Optional, Dict
label_desc: Use image node_id 1 for calling the TestClassType obj's underlying member method code with example usage: obj.test_reference_semantics() and returns: self, self