ó
    Î‘®i¦
  ã                  ó€   • S SK Jr  S SKJr  S SKrS SKJr  S SKJr  \(       a  S SKJ	r	   " S S\R                  5      rg)	é    )Úannotations)ÚTYPE_CHECKINGN)Údistribution)Úin_dynamic_mode)ÚTensorc                  óH   • \ rS rSrSr\S 5       rS r\S 5       rS	S jr	Sr
g)
ÚExponentialFamilyé   a…  
ExponentialFamily is the base class for probability distributions belonging
to exponential family, whose probability mass/density function has the
form is defined below

ExponentialFamily is derived from `paddle.distribution.Distribution`.

.. math::

    f_{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.

Distribution belongs to exponential family referring to https://en.wikipedia.org/wiki/Exponential_family
c                ó   • [         e©N©ÚNotImplementedError©Úselfs    Úf/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/distribution/exponential_family.pyÚ_natural_parametersÚ%ExponentialFamily._natural_parameters.   ó   € ä!Ð!ó    c                ó   • [         er   r   r   s    r   Ú_log_normalizerÚ!ExponentialFamily._log_normalizer2   s   € Ü!Ð!r   c                ó   • [         er   r   r   s    r   Ú_mean_carrier_measureÚ'ExponentialFamily._mean_carrier_measure5   r   r   c                óº  • U R                   * n/ nU R                   H+  nUR                  5       nSUl        UR	                  U5        M-     U R
                  " U6 n[        5       (       a%  [        R                  " UR                  5       USS9nO.[        R                  R                  UR                  5       U5      nX-  n[        X%5       H  u  pgXU-  -  nM     U$ )zlcalculate entropy use `bregman divergence`
https://www.lix.polytechnique.fr/~nielsen/EntropyEF-ICIP2010.pdf
FT)Úcreate_graph)r   r   ÚdetachÚstop_gradientÚappendr   r   ÚpaddleÚgradÚsumÚstaticÚ	gradientsÚzip)r   Úentropy_valueÚnatural_parametersÚ	parameterÚlog_normÚgradsÚpÚgs           r   ÚentropyÚExponentialFamily.entropy9   sÑ   € ð ×3Ñ3Ð3ˆàÐØ×1Ô1ˆIØ!×(Ñ(Ó*ˆIØ&+ˆIÔ#Ø×%Ñ% iÖ0ñ 2ð
 ×'Ò'Ð);Ð<ˆä×ÑÜ—K’KØ—‘“Ð 2Àñ‰Eô —M‘M×+Ñ+¨H¯L©L«NÐ<NÓOˆEàÑ!ˆÜÐ*Ö2‰DˆAØ ™UÑ"ŠMñ 3ð Ðr   © N)Úreturnr   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úpropertyr   r   r   r.   Ú__static_attributes__r0   r   r   r	   r	      s9   † ñð$ ñ"ó ð"ò"ð ñ"ó ð"÷r   r	   )Ú
__future__r   Útypingr   r!   Úpaddle.distributionr   Úpaddle.frameworkr   r   ÚDistributionr	   r0   r   r   Ú<module>r>      s.   ðõ #å  ã Ý ,Ý ,æÝô7˜×1Ñ1õ 7r   