Ë
    ˆ\;jo
  ã                   óN   — d dl Z d dlmZ d dlmZ  G d„ dej
                  «      Zy)é    N)Údistribution)Úin_dynamic_modec                   ó<   — e Zd ZdZed„ «       Zd„ Zed„ «       Zd„ Zy)ÚExponentialFamilya±  
    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                 ó   — t         ‚©N©ÚNotImplementedError©Úselfs    úoG:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\site-packages\paddle/distribution/exponential_family.pyÚ_natural_parametersz%ExponentialFamily._natural_parameters'   ó   € ä!Ð!ó    c                 ó   — t         ‚r   r	   r   s    r   Ú_log_normalizerz!ExponentialFamily._log_normalizer+   s   € Ü!Ð!r   c                 ó   — t         ‚r   r	   r   s    r   Ú_mean_carrier_measurez'ExponentialFamily._mean_carrier_measure.   r   r   c                 ó´  — | j                    }g }| j                  D ]*  }|j                  «       }d|_        |j	                  |«       Œ,  | j
                  |Ž }t        «       r't        j                  |j                  «       |d¬«      }n.t        j                  j                  |j                  «       |«      }||z  }t        ||«      D ]  \  }}|||z  z  }Œ |S )z{caculate 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   ÚentropyzExponentialFamily.entropy2   sØ   € ð ×3Ñ3Ð3ˆàÐØ×1Ô1ˆIØ!×(Ñ(Ó*ˆIØ&+ˆIÔ#Ø×%Ñ% iÕ0ð 2ð
 (�4×'Ñ'Ð);Ð<ˆäÔÜ—K‘KØ—‘“Ð 2Àô‰Eô —M‘M×+Ñ+¨H¯L©L«NÐ<NÓOˆEà˜Ñ!ˆÜÐ*¨EÖ2‰DˆAˆqØ˜Q ™UÑ"‰Mð 3ð Ðr   N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r   r   r'   © r   r   r   r      s9   „ ñð$ ñ"ó ð"ò"ð ñ"ó ð"ór   r   )r   Úpaddle.distributionr   Úpaddle.frameworkr   ÚDistributionr   r-   r   r   Ú<module>r1      s"   ðó Ý ,Ý ,ô7˜×1Ñ1õ 7r   