
    ȅi
                     h    S SK r S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	J
r
  S/r " S S\5      rg)	    N)Tensor)constraints)ExponentialFamily)broadcast_all)_Number_sizeExponentialc                   l  ^  \ rS rSrSrS\R                  0r\R                  r	Sr
Sr\S\4S j5       r\S\4S j5       r\S\4S	 j5       r\S\4S
 j5       r SS\\-  S\S-  SS4U 4S jjjrSU 4S jjr\R.                  " 5       4S\S\4S jjrS rS rS rS r\S\\   4S j5       rS r Sr!U =r"$ )r	      aJ  
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   returnc                 6    U R                   R                  5       $ Nr   
reciprocalselfs    Y/home/james-whalen/.local/lib/python3.13/site-packages/torch/distributions/exponential.pymeanExponential.mean#       yy##%%    c                 B    [         R                  " U R                  5      $ r   )torch
zeros_liker   r   s    r   modeExponential.mode'   s    		**r   c                 6    U R                   R                  5       $ r   r   r   s    r   stddevExponential.stddev+   r   r   c                 8    U R                   R                  S5      $ )N)r   powr   s    r   varianceExponential.variance/   s    yy}}R  r   Nvalidate_argsc                    > [        U5      u  U l        [        U[        5      (       a  [        R
                  " 5       OU R                  R                  5       n[        TU ]!  X2S9  g )Nr&   )	r   r   
isinstancer   r   Sizesizesuper__init__)r   r   r&   batch_shape	__class__s       r   r-   Exponential.__init__3   sG    
 %T*&0w&?&?ejjlTYY^^EUBr   c                    > U R                  [        U5      n[        R                  " U5      nU R                  R                  U5      Ul        [        [        U]  USS9  U R                  Ul        U$ )NFr(   )	_get_checked_instancer	   r   r*   r   expandr,   r-   _validate_args)r   r.   	_instancenewr/   s       r   r3   Exponential.expand<   s`    ((i@jj-99##K0k3(E(J!00
r   sample_shapec                     U R                  U5      nU R                  R                  U5      R                  5       U R                  -  $ r   )_extended_shaper   r6   exponential_)r   r8   shapes      r   rsampleExponential.rsampleD   s7    $$\2yy}}U#002TYY>>r   c                     U R                   (       a  U R                  U5        U R                  R                  5       U R                  U-  -
  $ r   )r4   _validate_sampler   logr   values     r   log_probExponential.log_probH   s7    !!%(yy}}U!222r   c                     U R                   (       a  U R                  U5        S[        R                  " U R                  * U-  5      -
  $ )N   )r4   r@   r   expr   rB   s     r   cdfExponential.cdfM   s8    !!%(599diiZ%/000r   c                 L    [         R                  " U* 5      * U R                  -  $ r   )r   log1pr   rB   s     r   icdfExponential.icdfR   s    UF##dii//r   c                 H    S[         R                  " U R                  5      -
  $ )Ng      ?)r   rA   r   r   s    r   entropyExponential.entropyU   s    UYYtyy)))r   c                     U R                   * 4$ r   r   r   s    r   _natural_paramsExponential._natural_paramsX   s    
}r   c                 2    [         R                  " U* 5      * $ r   )r   rA   )r   xs     r   _log_normalizerExponential._log_normalizer]   s    		1"~r   rS   r   )#__name__
__module____qualname____firstlineno____doc__r   positivearg_constraintsnonnegativesupporthas_rsample_mean_carrier_measurepropertyr   r   r   r   r$   floatboolr-   r3   r   r*   r   r=   rD   rI   rM   rP   tuplerT   rX   __static_attributes____classcell__)r/   s   @r   r	   r	      s2    {334O%%GK&f & & +f + + & & & !& ! ! &*CunC d{C 
	C C -2JJL ?E ?V ?3
1
0* v   r   )r   r   torch.distributionsr   torch.distributions.exp_familyr   torch.distributions.utilsr   torch.typesr   r   __all__r	    r   r   <module>rq      s1      + < 3 & /P# Pr   