+
    É&j–	  ã                   óB   € ^ RI t ^ RI Ht ^ RIHt R.t ! R R]4      tR# )é    N)ÚTensor)ÚDistributionÚExponentialFamilyc                   óh   a € ] tR t^t o Rt]V 3R lR l4       tR t]V 3R lR l4       tR t	Rt
V tR	# )
r   aš  
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).
c                ó4   <€ V ^8„  d   QhRS[ S[R3,          /# )é   Úreturn.)Útupler   )ÚformatÚ__classdict__s   "€Úv/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/distributions/exp_family.pyÚ__annotate__ÚExponentialFamily.__annotate__!   s   ø€ ÷ "ñ "¡¡v¨s {Õ!3ñ "ó    c                ó   € \         h)z^
Abstract method for natural parameters. Returns a tuple of Tensors based
on the distribution
©ÚNotImplementedError©Úselfs   &r   Ú_natural_paramsÚ!ExponentialFamily._natural_params    ó
   € ô "Ð!r   c                ó   € \         h)zk
Abstract method for log normalizer function. Returns a log normalizer based on
the distribution and input
r   )r   Únatural_paramss   &*r   Ú_log_normalizerÚ!ExponentialFamily._log_normalizer(   s
   € ô
 "Ð!r   c                ó    <€ V ^8„  d   QhRS[ /# )r   r	   )Úfloat)r   r   s   "€r   r   r   0   s   ø€ ÷ "ñ "¡uñ "r   c                ó   € \         h)zX
Abstract method for expected carrier measure, which is required for computing
entropy.
r   r   s   &r   Ú_mean_carrier_measureÚ'ExponentialFamily._mean_carrier_measure/   r   r   c                óÊ  € V P                   ) pV P                   Uu. uF   q"P                  4       P                  4       NK"  	  ppV P                  ! V!  p\
        P                  P                  VP                  4       VRR7      pW,          p\        W54       FC  w  rgWV,          P                  V P                  R,           4      P                  R4      ,          pKE  	  V# u upi )zO
Method to compute the entropy using Bregman divergence of the log normalizer.
T)Úcreate_graphéÿÿÿÿ)r$   )r    r   ÚdetachÚrequires_grad_r   ÚtorchÚautogradÚgradÚsumÚzipÚreshapeÚ_batch_shape)r   ÚresultÚpÚnparamsÚ	lg_normalÚ	gradientsÚnpÚgs   &       r   ÚentropyÚExponentialFamily.entropy7   s½   € ð #'×"<Ñ"<Ð!<ˆØ8<×8LÒ8LÓMÑ8L°1—8‘8“:×,Ñ,Ö.Ñ8LˆÐMØ×(Ò(¨'Ñ2ˆ	Ü—N‘N×'Ñ'¨	¯©«¸ÈtÐ'ÓTˆ	ØÕˆÜ˜Ö,‰EˆBØ˜A•v×&Ñ& t×'8Ñ'8¸5Õ'@ÓA×EÑEÀbÓIÕIŠFñ -àˆùò Ns   œ&C © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úpropertyr   r   r    r5   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      sA   ø‡ € ñð( ÷"ó ð"ò"ð ÷"ó ð"÷ð r   )r'   r   Ú torch.distributions.distributionr   Ú__all__r   r7   r   r   Ú<module>rB      s&   ðó Ý Ý 9ð Ð
€ô7˜ö 7r   