class_docstr: ExponentialFamily is the abstract base class for probability distributions belonging to an
  exponential family, whose probability mass/density function has the form is defined below
  
  .. math::
  
      p_{F}(x; \theta) = \exp(\langle t(x), \theta\rangle - F(\theta) + k(x))
  
  where :math:`\theta` denotes the natural parameters, :math:`t(x)` denotes the sufficient statistic,
  :math:`F(\theta)` is the log normalizer function for a given family and :math:`k(x)` is the carrier
  measure.
  
  Note:
      This class is an intermediary between the `Distribution` class and distributions which belong
      to an exponential family mainly to check the correctness of the `.entropy()` and analytic KL
      divergence methods. We use this class to compute the entropy and KL divergence using the AD
      framework and Bregman divergences (courtesy of: Frank Nielsen and Richard Nock, Entropies and
      Cross-entropies of Exponential Families).
docstr: Method to compute the entropy using Bregman divergence of the log normalizer.
docstr_tok: ["Method","to","compute","the","entropy","using","Bregman","divergence","of","the","log","normalizer","."]
code: def entropy(self):
      """
      Method to compute the entropy using Bregman divergence of the log normalizer.
      """
      result = -self._mean_carrier_measure
      nparams = [
          p.detach().requires_grad_() for p in self._natural_params
      ]
      lg_normal = self._log_normalizer(*nparams)
      gradients = torch.autograd.grad(
          lg_normal.sum(), nparams, create_graph=True
      )
      result += lg_normal
      for np, g in zip(nparams, gradients):
          result -= (np * g).reshape(self._batch_shape + (-1,)).sum(-1)
      return result
  
imports: import torch
  from torch.distributions.distribution import Distribution
label_desc: Use image node_id 4 for calling the ExponentialFamily obj's underlying member method code with example usage: obj.entropy() and returns: result