code: def testStructRefIsWeak(self):
      tensor_struct = {
          "a": tf.constant(1.0, name="alice"),
          "b": tf.constant(2.0, name="bob"),
          "c": tf.constant(3.0, name="carol"),
      }
  
      weak_ref = cache_util.WeakStructRef(tensor_struct)
      another_weak_ref = cache_util.WeakStructRef(tensor_struct)
  
      self.assertTrue(weak_ref.alive)
      del tensor_struct
  
      # In eager mode, references get cleaned up.
      if tf.executing_eagerly():
          self.assertFalse(weak_ref.alive)
          self.assertFalse(another_weak_ref.alive)
      # In graph mode, references stay alive.
      else:
          self.assertTrue(weak_ref.alive)
          self.assertTrue(another_weak_ref.alive)
  
imports: from absl.testing import parameterized
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import cache_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 3 for calling the HashableRefTest obj's underlying member method code with example usage: obj.testStructRefIsWeak() without return types