code: def _testMixtureReparameterizationGradients(
      self, mixture_func, parameters, function, num_samples
  ):
      assert function in ["mean", "variance"]
  
      if not self.use_static_shape:
          return
  
      def sample_estimate(*parameters):
          mixture = mixture_func(*parameters)
          values = mixture.sample(
              num_samples, seed=test_util.test_seed()
          )
          if function == "variance":
              values = tf.math.squared_difference(
                  values, mixture.mean()
              )
          return tf.reduce_mean(values, axis=0)
  
      def exact(*parameters):
          mixture = mixture_func(*parameters)
          # Normal mean does not depend on the scale, so add 0 * variance
          # to avoid None gradients. Also do the same for variance, just in case.
          if function == "variance":
              return mixture.variance() + 0 * mixture.mean()
          elif function == "mean":
              return mixture.mean() + 0 * mixture.variance()
  
      _, actual = gradient.value_and_gradient(
          sample_estimate, parameters
      )
      _, expected = gradient.value_and_gradient(exact, parameters)
      self.assertAllClose(actual, expected, atol=0.1, rtol=0.2)
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import logistic
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 17 for calling the _MixtureSameFamilyTest obj's underlying member method code with example usage: obj._testMixtureReparameterizationGradients(mixture_func, parameters, function, num_samples) and returns: tf, unknown, unknown