
    /j                     d    d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 dgZ
 G d de          ZdS )	    )Tensor)constraints)Normal)TransformedDistribution)ExpTransform	LogNormalc            	       $    e Zd ZU dZej        ej        dZej        ZdZ	e
ed<   	 ddeez  deez  dedz  d	df fd
Zd fd	Zed	efd            Zed	efd            Zed	efd            Zed	efd            Zed	efd            Zd Z xZS )r   a8  
    Creates a log-normal distribution parameterized by
    :attr:`loc` and :attr:`scale` where::

        X ~ Normal(loc, scale)
        Y = exp(X) ~ LogNormal(loc, scale)

    Example::

        >>> # xdoctest: +IGNORE_WANT("non-deterministic")
        >>> m = LogNormal(torch.tensor([0.0]), torch.tensor([1.0]))
        >>> m.sample()  # log-normal distributed with mean=0 and stddev=1
        tensor([ 0.1046])

    Args:
        loc (float or Tensor): mean of log of distribution
        scale (float or Tensor): standard deviation of log of the distribution
    )locscaleT	base_distNr
   r   validate_argsreturnc                     t          |||          }t                                          |t                      |           d S )N)r   )r   super__init__r   )selfr
   r   r   r   	__class__s        c/home/longshao/multi-rider-rag/.venv/lib/python3.11/site-packages/torch/distributions/log_normal.pyr   zLogNormal.__init__(   sB     3]CCC	LNN-PPPPP    c                     |                      t          |          }t                                          ||          S )N)	_instance)_get_checked_instancer   r   expand)r   batch_shaper   newr   s       r   r   zLogNormal.expand1   s2    ((I>>ww~~kS~999r   c                     | j         j        S N)r   r
   r   s    r   r
   zLogNormal.loc5   s    ~!!r   c                     | j         j        S r   )r   r   r   s    r   r   zLogNormal.scale9   s    ~##r   c                 p    | j         | j                            d          dz  z                                   S N   )r
   r   powexpr   s    r   meanzLogNormal.mean=   s.    4:>>!,,q0055777r   c                 h    | j         | j                                        z
                                  S r   )r
   r   squarer$   r   s    r   modezLogNormal.modeA   s)    4:,,...33555r   c                     | j                             d          }|                                d| j        z  |z                                   z  S r!   )r   r#   expm1r
   r$   )r   scale_sqs     r   variancezLogNormal.varianceE   sA    :>>!$$~~1tx<(#:"?"?"A"AAAr   c                 D    | j                                         | j        z   S r   )r   entropyr
   r   s    r   r.   zLogNormal.entropyJ   s    ~%%''$(22r   r   )__name__
__module____qualname____doc__r   realpositivearg_constraintssupporthas_rsampler   __annotations__r   floatboolr   r   propertyr
   r   r%   r(   r,   r.   __classcell__)r   s   @r   r   r      s         & *.9MNNO"GK &*	Q Qe^Q ~Q d{	Q
 
Q Q Q Q Q Q: : : : : : "V " " " X" $v $ $ $ X$ 8f 8 8 8 X8 6f 6 6 6 X6 B& B B B XB3 3 3 3 3 3 3r   N)torchr   torch.distributionsr   torch.distributions.normalr   ,torch.distributions.transformed_distributionr   torch.distributions.transformsr   __all__r    r   r   <module>rD      s          + + + + + + - - - - - - P P P P P P 7 7 7 7 7 7 ->3 >3 >3 >3 >3' >3 >3 >3 >3 >3r   