code: def testStructRefCallbackFiresOnce(self):
      tensor_struct = {
          "a": tf.constant(1.0, name="alice"),
          "b": tf.constant(2.0, name="bob"),
          "c": tf.constant(3.0, name="carol"),
      }
  
      callback_keys = []
  
      def callback(key):
          callback_keys.append(key)
  
      struct_ref = cache_util.WeakStructRef(
          tensor_struct, callback=callback
      )
  
      if tf.executing_eagerly():
          self.assertTrue(struct_ref.alive)
          self.assertEqual(callback_keys, [])
          del tensor_struct["a"]  # Goodbye, Alice!
          self.assertFalse(struct_ref.alive)
          self.assertEqual(callback_keys, [struct_ref])
          del tensor_struct["b"]  # Goodbye, Bob!
          self.assertEqual(callback_keys, [struct_ref])
          del tensor_struct  # Goodbye, everybody!
          self.assertEqual(callback_keys, [struct_ref])
  
      else:
          self.assertTrue(struct_ref.alive)
          del tensor_struct
          self.assertTrue(struct_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 4 for calling the HashableRefTest obj's underlying member method code with example usage: obj.testStructRefCallbackFiresOnce() without return types