o
    !‘i…	  ã                   @   sR   d dl mZ d dlZd dlmZ d dlmZ d dlmZ dgZ	G dd„ deƒZ
dS )é    )ÚNumberN)Úconstraints)ÚExponentialFamily)Úbroadcast_allÚExponentialc                       s¼   e Zd ZdZdejiZejZdZ	dZ
edd„ ƒZedd„ ƒZed	d
„ ƒZedd„ ƒZd ‡ fdd„	Zd ‡ fdd„	Ze ¡ fdd„Zdd„ Zdd„ Zdd„ Zdd„ Zedd„ ƒZdd„ Z‡  ZS )!r   am  
    Creates a Exponential distribution parameterized by :attr:`rate`.

    Example::

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

    Args:
        rate (float or Tensor): rate = 1 / scale of the distribution
    ÚrateTr   c                 C   ó
   | j  ¡ S ©N©r   Z
reciprocal©Úself© r   ún/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/torch/distributions/exponential.pyÚmean   ó   
zExponential.meanc                 C   s   t  | j¡S r	   )ÚtorchZ
zeros_liker   r   r   r   r   Úmode"   ó   zExponential.modec                 C   r   r	   r
   r   r   r   r   Ústddev&   r   zExponential.stddevc                 C   s   | j  d¡S )Néþÿÿÿ)r   Úpowr   r   r   r   Úvariance*   r   zExponential.varianceNc                    s<   t |ƒ\| _t|tƒrt ¡ n| j ¡ }tƒ j||d d S )N©Úvalidate_args)	r   r   Ú
isinstancer   r   ÚSizeÚsizeÚsuperÚ__init__)r   r   r   Úbatch_shape©Ú	__class__r   r   r   .   s   zExponential.__init__c                    sD   |   t|¡}t |¡}| j |¡|_tt|ƒj|dd | j|_|S )NFr   )	Z_get_checked_instancer   r   r   r   Úexpandr   r   Ú_validate_args)r   r   Z	_instanceÚnewr    r   r   r"   3   s   
zExponential.expandc                 C   s    |   |¡}| j |¡ ¡ | j S r	   )Z_extended_shaper   r$   Zexponential_)r   Zsample_shapeÚshaper   r   r   Úrsample;   s   
zExponential.rsamplec                 C   s$   | j r|  |¡ | j ¡ | j|  S r	   )r#   Ú_validate_sampler   Úlog©r   Úvaluer   r   r   Úlog_prob?   s   
zExponential.log_probc                 C   s&   | j r|  |¡ dt | j | ¡ S )Né   )r#   r'   r   Úexpr   r)   r   r   r   ÚcdfD   s   
zExponential.cdfc                 C   s   t  | ¡ | j S r	   )r   Úlog1pr   r)   r   r   r   ÚicdfI   s   zExponential.icdfc                 C   s   dt  | j¡ S )Ng      ð?)r   r(   r   r   r   r   r   ÚentropyL   s   zExponential.entropyc                 C   s
   | j  fS r	   )r   r   r   r   r   Ú_natural_paramsO   r   zExponential._natural_paramsc                 C   s   t  | ¡ S r	   )r   r(   )r   Úxr   r   r   Ú_log_normalizerS   s   zExponential._log_normalizerr	   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ZpositiveZarg_constraintsZnonnegativeZsupportZhas_rsampleZ_mean_carrier_measureÚpropertyr   r   r   r   r   r"   r   r   r&   r+   r.   r0   r1   r2   r4   Ú__classcell__r   r   r    r   r      s0    





)Únumbersr   r   Ztorch.distributionsr   Ztorch.distributions.exp_familyr   Ztorch.distributions.utilsr   Ú__all__r   r   r   r   r   Ú<module>   s    