code: def testValuesAreCorrect(self, feature_ndims, dims):
      num_components = 7
      seed_stream = test_util.test_seed_stream("params")
      logits = tf.random.normal([num_components], seed=seed_stream())
      locs = tf.random.normal(
          [num_components] + [dims] * feature_ndims, seed=seed_stream()
      )
      scales = tf.random.uniform(
          [num_components] + [dims] * feature_ndims,
          minval=1.0,
          maxval=2.0,
          seed=seed_stream(),
      )
      logits, locs, scales = self.evaluate([logits, locs, scales])
  
      k = spectral_mixture.SpectralMixture(
          logits, locs=locs, scales=scales, feature_ndims=feature_ndims
      )
      shape = [dims] * feature_ndims
      for _ in range(5):
          x = np.random.uniform(-1, 1, size=shape).astype(np.float32)
          y = np.random.uniform(-1, 1, size=shape).astype(np.float32)
          self.assertAllClose(
              self._spectral_mixture(
                  logits, locs, scales, x, y, feature_ndims
              ),
              self.evaluate(k.apply(x, y)),
          )
  
      shape = [2] + [dims] * feature_ndims
      x = np.random.uniform(-1, 1, size=shape).astype(np.float32)
      kernel_matrix = [
          [
              self._spectral_mixture(
                  logits, locs, scales, x[0], x[0], feature_ndims
              ),
              self._spectral_mixture(
                  logits, locs, scales, x[0], x[1], feature_ndims
              ),
          ],
          [
              self._spectral_mixture(
                  logits, locs, scales, x[1], x[0], feature_ndims
              ),
              self._spectral_mixture(
                  logits, locs, scales, x[1], x[1], feature_ndims
              ),
          ],
      ]
      self.assertAllClose(
          kernel_matrix, self.evaluate(k.matrix(x, x)), rtol=1e-4
      )
  
file_path: probability/tensorflow_probability/python/math/psd_kernels/spectral_mixture_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math.psd_kernels import spectral_mixture
label_desc: Use image node_id 2 for calling the SpectralMixtureTest obj's underlying member method code with example usage: obj.testValuesAreCorrect(feature_ndims, dims) without return types