3
O4W^  ใ               @   s,   d dl mZ d dlmZ G dd deZdS )้    )ฺconstraints)ฺGammac                   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 )ฺChi2ar  
    Creates a Chi2 distribution parameterized by shape parameter :attr:`df`.
    This is exactly equivalent to ``Gamma(alpha=0.5*df, beta=0.5)``

    Example::

        >>> 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 t| jd| d|d d S )Ng      เ?)ฺvalidate_args)ฺsuperr   ฺ__init__)ฺselfr   r   )ฺ	__class__ฉ ๚9/tmp/pip-build-e66j97b2/torch/torch/distributions/chi2.pyr      s    zChi2.__init__c                s   | j t|}tt| j||S )N)Z_get_checked_instancer   r   ฺexpand)r	   Zbatch_shapeZ	_instanceฺnew)r
   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
   
r   N)Ztorch.distributionsr   Ztorch.distributions.gammar   r   r   r   r   r   ฺ<module>   s   