code: def testTypeObjectLeakage(self):
      if not tf.executing_eagerly():
          self.skipTest("only relevant to eager")
  
      layer = distribution_layer.DistributionLambda(
          categorical.Categorical
      )
      x = tf.constant([-0.23, 1.23, 1.42])
      dist = layer(x)
      # Investigate why the second layer call creates a few more weakrefs.
      # These weakrefs could potentially come from tf.function.variables.
      dist = layer(x)
      gc.collect()
      before_objs = len(gc.get_objects())
      for _ in range(int(1e2)):
          dist = layer(x)
      gc.collect()
      after_objs = len(gc.get_objects())
      del dist
  
      # This was 43150(py2)/43750(py3) before PR#532.
      self.assertLess(after_objs - before_objs, 1)
  
imports: import gc
  import operator
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.layers import distribution_layer
  from tensorflow_probability.python.layers.internal import distribution_tensor_coercible
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 1 for calling the MemoryLeakTest obj's underlying member method code with example usage: obj.testTypeObjectLeakage() without return types