Ë
    óÍ:j»
  ã                   ót   — 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y)
é    )Ú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                  j                  d«       }t        ‰| �  |t        |«      |¬«       y )N)r   © )r   r   Únew_onesÚsuperÚ__init__r	   )Úselfr   r   r   r   Úneg_oneÚ	__class__s         €úv/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/torch/distributions/inverse_gamma.pyr   zInverseGamma.__init__-   sH   ø€ ô ˜-¨¸]Ô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.expand9   s(   ø€ Ø×(Ñ(¬°yÓAˆÜ‰w‰~˜k°Sˆ~Ó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                 óž   — | j                   | j                  dz
  z  }t        j                  | j                  dkD  |t        j                  «      S ©Né   )r   r   ÚtorchÚwhereÚinf©r   Úresults     r   ÚmeanzInverseGamma.meanE   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.modeJ   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.varianceN   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.entropyU   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   Ú__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ò ,ó ð,ð ð#�fò #ó ð#ð ðF�fò Fó ðFð ð4�fò 4ó ð4ð ðF˜&ò Fó ð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      s3   ðç "ã Ý Ý +Ý +Ý PÝ 9ð Ð
€ôL
Ð*õ L
r   