Ë
    f^(h
  ã                   ód   — d dl Z d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 dgZ
 G d„ de«      Zy)	é    N)ÚTensor)Úconstraints)ÚGamma)ÚTransformedDistribution)ÚPowerTransformÚInverseGammac                   óò   ‡ — e Zd ZdZej
                  ej
                  dœZej
                  ZdZdˆ fd„	Z	dˆ fd„	Z
edefd„«       Zedefd„«       Zedefd	„«       Zedefd
„«       Zedefd„«       Zd„ Zˆ xZS )r   a€  
    Creates an inverse gamma distribution parameterized by :attr:`concentration` and :attr:`rate`
    where::

        X ~ Gamma(concentration, rate)
        Y = 1 / X ~ InverseGamma(concentration, rate)

    Example::

        >>> # xdoctest: +IGNORE_WANT("non-deterinistic")
        >>> m = InverseGamma(torch.tensor([2.0]), torch.tensor([3.0]))
        >>> m.sample()
        tensor([ 1.2953])

    Args:
        concentration (float or Tensor): shape parameter of the distribution
            (often referred to as alpha)
        rate (float or Tensor): rate = 1 / scale of the distribution
            (often referred to as beta)
    )ÚconcentrationÚrateTc                 ó�   •— t        |||¬«      }|j                  j                  d«       }t        ‰| �  |t        |«      |¬«       y )N)Úvalidate_args© )r   r   Únew_onesÚsuperÚ__init__r   )Úselfr
   r   r   Ú	base_distÚneg_oneÚ	__class__s         €ú_/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/distributions/inverse_gamma.pyr   zInverseGamma.__init__*   sF   ø€ Ü˜-¨¸]ÔKˆ	Ø—>‘>×*Ñ*¨2Ó.Ð.ˆÜ‰ÑØ”~ gÓ.¸mð 	õ 	
ó    c                 óR   •— | j                  t        |«      }t        ‰| �  ||¬«      S )N)Ú	_instance)Ú_get_checked_instancer   r   Úexpand)r   Úbatch_shaper   Únewr   s       €r   r   zInverseGamma.expand1   s(   ø€ Ø×(Ñ(¬°yÓAˆÜ‰w‰~˜k°Sˆ~Ó9Ð9r   Úreturnc                 ó.   — | j                   j                  S ©N)r   r
   ©r   s    r   r
   zInverseGamma.concentration5   s   € à�~‰~×+Ñ+Ð+r   c                 ó.   — | j                   j                  S r    )r   r   r!   s    r   r   zInverseGamma.rate9   s   € à�~‰~×"Ñ"Ð"r   c                 óž   — | j                   | j                  dz
  z  }t        j                  | j                  dkD  |t        j                  «      S ©Né   )r   r
   ÚtorchÚwhereÚinf©r   Úresults     r   ÚmeanzInverseGamma.mean=   s=   € à—‘˜d×0Ñ0°1Ñ4Ñ5ˆÜ�{‰{˜4×-Ñ-°Ñ1°6¼5¿9¹9ÓEÐEr   c                 ó:   — | j                   | j                  dz   z  S r$   )r   r
   r!   s    r   ÚmodezInverseGamma.modeB   s   € à�y‰y˜D×.Ñ.°Ñ2Ñ3Ð3r   c                 óö   — | j                   j                  «       | j                  dz
  j                  «       | j                  dz
  z  z  }t        j                  | j                  dkD  |t        j
                  «      S )Nr%   é   )r   Úsquarer
   r&   r'   r(   r)   s     r   ÚvariancezInverseGamma.varianceF   sd   € à—‘×!Ñ!Ó#Ø×Ñ !Ñ#×+Ñ+Ó-°×1CÑ1CÀaÑ1GÑHñ
ˆô �{‰{˜4×-Ñ-°Ñ1°6¼5¿9¹9ÓEÐEr   c                 óÜ   — | j                   | j                  j                  «       z   | j                   j                  «       z   d| j                   z   | j                   j	                  «       z  z
  S r$   )r
   r   ÚlogÚlgammaÚdigammar!   s    r   ÚentropyzInverseGamma.entropyM   sc   € à×ÑØ�i‰i�m‰m‹oñà× Ñ ×'Ñ'Ó)ñ*ð �4×%Ñ%Ñ%¨×);Ñ);×)CÑ)CÓ)EÑEñFð	
r   r    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚpositiveÚarg_constraintsÚsupportÚhas_rsampler   r   Úpropertyr   r
   r   r+   r-   r1   r6   Ú__classcell__)r   s   @r   r   r      sÑ   ø„ ñð, %×-Ñ-Ø×$Ñ$ñ€Oð ×"Ñ"€GØ€Kõ
õ:ð ð,˜vò ,ó ð,ð ð#�fò #ó ð#ð ðF�fò Fó ðFð ð4�fò 4ó ð4ð ðF˜&ò Fó ðFö
r   )r&   r   Útorch.distributionsr   Útorch.distributions.gammar   Ú,torch.distributions.transformed_distributionr   Útorch.distributions.transformsr   Ú__all__r   r   r   r   ú<module>rF      s0   ðã Ý Ý +Ý +Ý PÝ 9ð Ð
€ôF
Ð*õ F
r   