§
    ®˜ºh»
  ã                   ó|   — d dl mZmZ 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dS )
é    )ÚOptionalÚUnionN)ÚTensor)Úconstraints)ÚGamma)ÚTransformedDistribution)ÚPowerTransformÚInverseGammac            	       ó>  ‡ — e Zd ZU dZej        ej        dœZej        ZdZe	e
d<   	 ddeeef         deeef         dee         d	dfˆ 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ÚrateTÚ	base_distNr   r   Úvalidate_argsÚreturnc                 óÄ   •— t          |||¬¦  «        }|j                             d¦  «         }t          ¦   «                              |t          |¦  «        |¬¦  «         d S )N)r   © )r   r   Únew_onesÚsuperÚ__init__r	   )Úselfr   r   r   r   Úneg_oneÚ	__class__s         €úi/var/www/html/services/rag-service/venv/lib/python3.11/site-packages/torch/distributions/inverse_gamma.pyr   zInverseGamma.__init__-   sk   ø€ õ ˜-¨¸]ÐKÑKÔKˆ	Ø”>×*Ò*¨2Ñ.Ô.Ð.ˆÝ‰Œ×ÒØ•~ gÑ.Ô.¸mð 	ñ 	
ô 	
ð 	
ð 	
ð 	
ó    c                 ó€   •— |                       t          |¦  «        }t          ¦   «                              ||¬¦  «        S )N)Ú	_instance)Ú_get_checked_instancer
   r   Úexpand)r   Úbatch_shaper   Únewr   s       €r   r   zInverseGamma.expand9   s2   ø€ Ø×(Ò(­°yÑAÔAˆÝ‰wŒw�~Š~˜k°Sˆ~Ñ9Ô9Ð9r   c                 ó   — | j         j        S ©N)r   r   ©r   s    r   r   zInverseGamma.concentration=   s   € àŒ~Ô+Ð+r   c                 ó   — | j         j        S r"   )r   r   r#   s    r   r   zInverseGamma.rateA   s   € àŒ~Ô"Ð"r   c                 óx   — | j         | j        dz
  z  }t          j        | j        dk    |t          j        ¦  «        S ©Né   )r   r   ÚtorchÚwhereÚinf©r   Úresults     r   ÚmeanzInverseGamma.meanE   s4   € à”˜dÔ0°1Ñ4Ñ5ˆÝŒ{˜4Ô-°Ò1°6½5¼9ÑEÔEÐEr   c                 ó&   — | j         | j        dz   z  S r&   )r   r   r#   s    r   ÚmodezInverseGamma.modeJ   s   € àŒy˜DÔ.°Ñ2Ñ3Ð3r   c                 óÖ   — | j                              ¦   «         | j        dz
                       ¦   «         | j        dz
  z  z  }t          j        | j        dk    |t          j        ¦  «        S )Nr'   é   )r   Úsquarer   r(   r)   r*   r+   s     r   ÚvariancezInverseGamma.varianceN   s^   € à”×!Ò!Ñ#Ô#ØÔ !Ñ#×+Ò+Ñ-Ô-°Ô1CÀaÑ1GÑHñ
ˆõ Œ{˜4Ô-°Ò1°6½5¼9ÑEÔEÐEr   c                 óÂ   — | j         | j                             ¦   «         z   | j                              ¦   «         z   d| j         z   | j                              ¦   «         z  z
  S r&   )r   r   ÚlogÚlgammaÚdigammar#   s    r   ÚentropyzInverseGamma.entropyU   s]   € àÔØŒi�mŠm‰oŒoñàÔ ×'Ò'Ñ)Ô)ñ*ð �4Ô%Ñ%¨Ô);×)CÒ)CÑ)EÔ)EÑEñFð	
r   r"   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚpositiveÚarg_constraintsÚsupportÚhas_rsampler   Ú__annotations__r   r   Úfloatr   Úboolr   r   Úpropertyr   r   r-   r/   r3   r8   Ú__classcell__)r   s   @r   r
   r
      s¾  ø€ € € € € € ðð ð, %Ô-ØÔ$ðð €Oð Ô"€GØ€KØÐÐÑð )-ð	

ð 

à˜V U˜]Ô+ð

ð �F˜E�MÔ"ð

ð   ”~ð	

ð
 
ð

ð 

ð 

ð 

ð 

ð 

ð:ð :ð :ð :ð :ð :ð ð,˜vð ,ð ,ð ,ñ „Xð,ð ð#�fð #ð #ð #ñ „Xð#ð ðF�fð Fð Fð Fñ „XðFð ð4�fð 4ð 4ð 4ñ „Xð4ð ðF˜&ð Fð Fð Fñ „XðFð
ð 
ð 
ð 
ð 
ð 
ð 
r   )Útypingr   r   r(   r   Útorch.distributionsr   Útorch.distributions.gammar   Ú,torch.distributions.transformed_distributionr   Útorch.distributions.transformsr	   Ú__all__r
   r   r   r   ú<module>rL      sÉ   ðà "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ð Ð Ø +Ð +Ð +Ð +Ð +Ð +Ø +Ð +Ð +Ð +Ð +Ð +Ø PÐ PÐ PÐ PÐ PÐ PØ 9Ð 9Ð 9Ð 9Ð 9Ð 9ð Ð
€ðL
ð L
ð L
ð L
ð L
Ð*ñ L
ô L
ð L
ð L
ð L
r   