class_docstr: The von Mises-Fisher distribution over unit vectors on `S^{n-1}`.
  
  The von Mises-Fisher distribution is a directional distribution over vectors
  on the unit hypersphere `S^{n-1}` embedded in `n` dimensions (`R^n`).
  
  #### Mathematical details
  
  The probability density function (pdf) is,
  
  ```none
  pdf(x; mu, kappa) = C(kappa) exp(kappa * mu^T x)
  where,
  C(kappa) = (2 pi)^{-n/2} kappa^{n/2-1} / I_{n/2-1}(kappa),
  I_v(z) being the modified Bessel function of the first kind of order v
  ```
  
  where:
  * `mean_direction = mu`; a unit vector in `R^k`,
  * `concentration = kappa`; scalar real >= 0, concentration of samples around
    `mean_direction`, where 0 pertains to the uniform distribution on the
    hypersphere, and \inf indicates a delta function at `mean_direction`.
  
  
  NOTE: Currently only n in {2, 3, 4, 5} are supported. For n=5 some numerical
  instability can occur for low concentrations (<.01).
  
  NOTE: `mean_direction` is not in general the mean of the distribution. For
  spherical distributions, the mean is generally not in the support of the
  distribution.
  
  #### Examples
  
  A single instance of a vMF distribution is defined by a mean direction (or
  mode) unit vector and a scalar concentration parameter.
  
  Extra leading dimensions, if provided, allow for batches.
  
  ```python
  tfd = tfp.distributions
  
  # Initialize a single 3-dimension vMF distribution.
  mu = [0., 1, 0]
  conc = 1.
  vmf = tfd.VonMisesFisher(mean_direction=mu, concentration=conc)
  
  # Evaluate this on an observation in S^2 (in R^3), returning a scalar.
  vmf.prob([1., 0, 0])
  
  # Initialize a batch of two 3-variate vMF distributions.
  mu = [[0., 1, 0],
        [1., 0, 0]]
  conc = [1., 2]
  vmf = tfd.VonMisesFisher(mean_direction=mu, concentration=conc)
  
  # Evaluate this on two observations, each in S^2, returning a length two
  # tensor.
  x = [[0., 0, 1],
       [0., 1, 0]]
  vmf.prob(x)
  ```
class_docstr_tok: ["The","von","Mises-Fisher","distribution","over","unit","vectors","on","`","S^","{","n-1","}","`",".","The","von","Mises-Fisher","distribution","is","a","directional","distribution","over","vectors","on","the","unit","hypersphere","`","S^","{","n-1","}","`","embedded","in","`","n","`","dimensions","(","`","R^n","`",")",".","#","#","#","#","Mathematical","details","The","probability","density","function","(","pdf",")","is",",","``","`","none","pdf","(","x",";","mu",",","kappa",")","=","C","(","kappa",")","exp","(","kappa","*","mu^T","x",")","where",",","C","(","kappa",")","=","(","2","pi",")","^","{","-n\/2","}","kappa^","{","n\/2-1","}","\/","I_","{","n\/2-1","}","(","kappa",")",",","I_v","(","z",")","being","the","modified","Bessel","function","of","the","first","kind","of","order","v","``","`","where",":","*","`","mean_direction","=","mu","`",";","a","unit","vector","in","`","R^k","`",",","*","`","concentration","=","kappa","`",";","scalar","real",">","=","0",",","concentration","of","samples","around","`","mean_direction","`",",","where","0","pertains","to","the","uniform","distribution","on","the","hypersphere",",","and","\\inf","indicates","a","delta","function","at","`","mean_direction","`",".","NOTE",":","Currently","only","n","in","{","2",",","3",",","4",",","5","}","are","supported",".","For","n=5","some","numerical","instability","can","occur","for","low","concentrations","(","<",".01",")",".","NOTE",":","`","mean_direction","`","is","not","in","general","the","mean","of","the","distribution",".","For","spherical","distributions",",","the","mean","is","generally","not","in","the","support","of","the","distribution",".","#","#","#","#","Examples","A","single","instance","of","a","vMF","distribution","is","defined","by","a","mean","direction","(","or","mode",")","unit","vector","and","a","scalar","concentration","parameter",".","Extra","leading","dimensions",",","if","provided",",","allow","for","batches",".","``","`","python","tfd","=","tfp.distributions","#","Initialize","a","single","3-dimension","vMF","distribution",".","mu","=","[","0.",",","1",",","0","]","conc","=","1.","vmf","=","tfd.VonMisesFisher","(","mean_direction=mu",",","concentration=conc",")","#","Evaluate","this","on","an","observation","in","S^2","(","in","R^3",")",",","returning","a","scalar",".","vmf.prob","(","[","1.",",","0",",","0","]",")","#","Initialize","a","batch","of","two","3-variate","vMF","distributions",".","mu","=","[","[","0.",",","1",",","0","]",",","[","1.",",","0",",","0","]","]","conc","=","[","1.",",","2","]","vmf","=","tfd.VonMisesFisher","(","mean_direction=mu",",","concentration=conc",")","#","Evaluate","this","on","two","observations",",","each","in","S^2",",","returning","a","length","two","#","tensor",".","x","=","[","[","0.",",","0",",","1","]",",","[","0.",",","1",",","0","]","]","vmf.prob","(","x",")","``","`"]
code: def _entropy(self):
      mean_direction = tf.convert_to_tensor(self.mean_direction)
      event_dimension = tf.cast(
          self._event_shape_tensor(mean_direction=mean_direction)[0],
          dtype=self.dtype,
      )
      concentration = tf.convert_to_tensor(self.concentration)
      # Compared to [1] (see the KL(VonMisesFisher || SphericalUniform) for the
      # exact reference, we add the log normalization constant rather than
      # subtract it. This is because in TFP, we have the convention that we
      # normalize our distributions p(x) by a constant 1 / Z. Taking the log
      # gives us a negative sign.
      entropy = -concentration * bessel.bessel_iv_ratio(
          event_dimension / 2.0, concentration
      ) + self._log_normalization(concentration=concentration)
  
      return tf.broadcast_to(
          entropy,
          self._batch_shape_tensor(
              mean_direction=mean_direction, concentration=concentration
          ),
      )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import softmax_centered
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.bijectors import square
  from tensorflow_probability.python.distributions import beta
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import spherical_uniform
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math import bessel
label_desc: Use image node_id 14 for calling the VonMisesFisher obj's underlying member method code with example usage: obj._entropy() and returns: tf