U
    ©Ê¹jÍ  ã                   @   s2   d dl mZ d dlmZ dgZG dd„ deƒZdS )é    )Úconstraints)ÚGammaÚChi2c                       sF   e Zd ZdZdejiZd
‡ fdd„	Zd‡ fdd„	Ze	dd	„ ƒZ
‡  ZS )r   a²  
    Creates a Chi-squared distribution parameterized by shape parameter :attr:`df`.
    This is exactly equivalent to ``Gamma(alpha=0.5*df, beta=0.5)``

    Example::

        >>> # xdoctest: +IGNORE_WANT("non-deterinistic")
        >>> m = Chi2(torch.tensor([1.0]))
        >>> m.sample()  # Chi2 distributed with shape df=1
        tensor([ 0.1046])

    Args:
        df (float or Tensor): shape parameter of the distribution
    ÚdfNc                    s   t ƒ jd| d|d� d S )Ng      à?)Úvalidate_args)ÚsuperÚ__init__)Úselfr   r   ©Ú	__class__© úW/var/www/html/bwave/python/venv/lib/python3.8/site-packages/torch/distributions/chi2.pyr      s    zChi2.__init__c                    s   |   t|¡}tƒ  ||¡S )N)Z_get_checked_instancer   r   Úexpand)r	   Zbatch_shapeZ	_instanceÚnewr
   r   r   r      s    zChi2.expandc                 C   s
   | j d S )Né   )Zconcentration)r	   r   r   r   r      s    zChi2.df)N)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ZpositiveZarg_constraintsr   r   Úpropertyr   Ú__classcell__r   r   r
   r   r      s   
N)Ztorch.distributionsr   Ztorch.distributions.gammar   Ú__all__r   r   r   r   r   Ú<module>   s   