o
    /ôj¡	  ã                   @   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   an  
    Creates a Exponential distribution parameterized by :attr:`rate`.

    Example::

        >>> # xdoctest: +IGNORE_WANT("non-deterministic")
        >>> 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   Ú
reciprocal©Úself© r   úp/var/www/html/academy/tools/voices/clone/sv-venv/lib/python3.10/site-packages/torch/distributions/exponential.pyÚmean   ó   
zExponential.meanc                 C   s   t  | j¡S r	   )ÚtorchÚ
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   )	Ú_get_checked_instancer   r   r   r   Úexpandr   r    Ú_validate_args)r   r!   Ú	_instanceÚnewr"   r   r   r%   4   s   
zExponential.expandc                 C   s    |   |¡}| j |¡ ¡ | j S r	   )Ú_extended_shaper   r(   Úexponential_)r   Ú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   r0   r   r   r   ÚcdfE   s   
zExponential.cdfc                 C   s   t  | ¡ | j S r	   )r   Úlog1pr   r0   r   r   r   ÚicdfJ   s   zExponential.icdfc                 C   s   dt  | j¡ S )Ng      ð?)r   r/   r   r   r   r   r   ÚentropyM   s   zExponential.entropyc                 C   s
   | j  fS r	   )r   r   r   r   r   Ú_natural_paramsP   r   zExponential._natural_paramsc                 C   s   t  | ¡ S r	   )r   r/   )r   Úxr   r   r   Ú_log_normalizerT   s   zExponential._log_normalizerr	   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚpositiveÚarg_constraintsÚnonnegativeÚsupportÚhas_rsampleÚ_mean_carrier_measureÚpropertyr   r   r   r   r    r%   r   r   r-   r2   r5   r7   r8   r9   r;   Ú__classcell__r   r   r"   r   r      s0    





)Únumbersr   r   Ztorch.distributionsr   Útorch.distributions.exp_familyr   Útorch.distributions.utilsr   Ú__all__r   r   r   r   r   Ú<module>   s   