docstr: Verifies log_prob evaluations with numpy/scipy.
  
  Both uniform random points and sampled points are evaluated.
  
  Args:
    vmf: A `tfp.distributions.VonMisesFisher` instance.
    atol: Absolute difference tolerable.
docstr_tok: ["Verifies","log_prob","evaluations","with","numpy\/scipy",".","Both","uniform","random","points","and","sampled","points","are","evaluated",".","Args",":","vmf",":","A","`","tfp.distributions.VonMisesFisher","`","instance",".","atol",":","Absolute","difference","tolerable","."]
code: def _verifyPdfWithNumpy(self, vmf, atol=1e-4):
      """Verifies log_prob evaluations with numpy/scipy.
  
      Both uniform random points and sampled points are evaluated.
  
      Args:
        vmf: A `tfp.distributions.VonMisesFisher` instance.
        atol: Absolute difference tolerable.
      """
      dim = tf.compat.dimension_value(vmf.event_shape[-1])
      nsamples = 10
      # Sample some random points uniformly over the hypersphere using numpy.
      sample_shape = (
          [nsamples] + tensorshape_util.as_list(vmf.batch_shape) + [dim]
      )
      uniforms = np.random.randn(*sample_shape)
      uniforms /= np.linalg.norm(uniforms, axis=-1, keepdims=True)
      uniforms = uniforms.astype(dtype_util.as_numpy_dtype(vmf.dtype))
      # Concatenate in some sampled points from the distribution under test.
      vmf_samples = vmf.sample(
          sample_shape=[nsamples], seed=test_util.test_seed()
      )
      samples = tf.concat([uniforms, vmf_samples], axis=0)
      log_prob = vmf.log_prob(samples)
      samples = tf.debugging.check_numerics(samples, "samples")
      log_prob = tf.debugging.check_numerics(log_prob, "log_prob")
      samples, log_prob, conc, mean_dir = self.evaluate(
          [samples, log_prob, vmf.concentration, vmf.mean_direction]
      )
      log_true_sphere_surface_area = (
          np.log(2)
          + (dim / 2) * np.log(np.pi)
          - sp_special.gammaln(dim / 2)
      )
      expected = conc * np.sum(samples * mean_dir, axis=-1) + np.where(
          conc > 0,
          (dim / 2 - 1) * np.log(conc)
          - (dim / 2) * np.log(2 * np.pi)
          - np.log(sp_special.ive(dim / 2 - 1, conc))
          - np.abs(conc),
          -log_true_sphere_surface_area,
      )
      self.assertAllClose(expected, log_prob, atol=atol)
  
imports: from absl.testing import parameterized
  import numpy
  from scipy import special
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import spherical_uniform
  from tensorflow_probability.python.distributions import von_mises_fisher
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 4 for calling the VonMisesFisherTest obj's underlying member method code with example usage: obj._verifyPdfWithNumpy(vmf, atol) without return types