code: def testCompositeTensor(self, kernel_name, data):
      kernel, _ = data.draw(
          kernel_hps.kernels(
              kernel_name=kernel_name,
              event_dim=2,
              feature_dim=2,
              feature_ndims=1,
              enable_vars=True,
          )
      )
      self.assertIsInstance(kernel, tf.__internal__.CompositeTensor)
  
      xs = tf.identity(
          data.draw(
              kernel_hps.kernel_input(
                  batch_shape=[],
                  example_ndims=1,
                  feature_dim=2,
                  feature_ndims=1,
              )
          )
      )
      with tfp_hps.no_tf_rank_errors():
          diag = kernel.apply(xs, xs, example_ndims=1)
  
      # Test flatten/unflatten.
      flat = tf.nest.flatten(kernel, expand_composites=True)
      unflat = tf.nest.pack_sequence_as(
          kernel, flat, expand_composites=True
      )
  
      # Test tf.function.
      @tf.function
      def diag_fn(k):
          return k.apply(xs, xs, example_ndims=1)
  
      self.evaluate([v.initializer for v in kernel.variables])
      with tfp_hps.no_tf_rank_errors():
          self.assertAllClose(diag, diag_fn(kernel))
          self.assertAllClose(diag, diag_fn(unflat))
  
      self.assertConvertVariablesToTensorsWorks(kernel)
  
file_path: probability/tensorflow_probability/python/math/psd_kernels/psd_kernel_properties_test.py
imports: import collections
  from absl.testing import parameterized
  import hypothesis
  from hypothesis import strategies
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math.psd_kernels import hypothesis_testlib
label_desc: Use image node_id 2 for calling the KernelPropertiesTest obj's underlying member method code with example usage: obj.testCompositeTensor(kernel_name, data) and returns: k