
    Vh                     \    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y)	    )Tensor)constraints)Normal)TransformedDistribution)ExpTransform	LogNormalc                        e Zd ZdZej
                  ej                  dZej                  ZdZ	d 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scaleTc                 V    t        |||      }t        | 	  |t               |       y )N)validate_args)r   super__init__r   )selfr
   r   r   	base_dist	__class__s        N/home/dcms/DCMS/lib/python3.12/site-packages/torch/distributions/log_normal.pyr   zLogNormal.__init__$   s'    3]C	LN-P    c                 R    | j                  t        |      }t        |   ||      S )N)	_instance)_get_checked_instancer   r   expand)r   batch_shaper   newr   s       r   r   zLogNormal.expand(   s(    ((I>w~kS~99r   returnc                 .    | j                   j                  S N)r   r
   r   s    r   r
   zLogNormal.loc,   s    ~~!!!r   c                 .    | j                   j                  S r   )r   r   r   s    r   r   zLogNormal.scale0   s    ~~###r   c                 t    | j                   | j                  j                  d      dz  z   j                         S N   )r
   r   powexpr   s    r   meanzLogNormal.mean4   s,    4::>>!,q005577r   c                 l    | j                   | j                  j                         z
  j                         S r   )r
   r   squarer$   r   s    r   modezLogNormal.mode8   s'    4::,,..3355r   c                     | j                   j                  d      }|j                         d| j                  z  |z   j	                         z  S r!   )r   r#   expm1r
   r$   )r   scale_sqs     r   variancezLogNormal.variance<   s<    ::>>!$~~1txx<(#:"?"?"AAAr   c                 P    | j                   j                         | j                  z   S r   )r   entropyr
   r   s    r   r.   zLogNormal.entropyA   s    ~~%%'$((22r   r   )__name__
__module____qualname____doc__r   realpositivearg_constraintssupporthas_rsampler   r   propertyr   r
   r   r%   r(   r,   r.   __classcell__)r   s   @r   r   r      s    & *..9M9MNO""GKQ: "V " " $v $ $ 8f 8 8 6f 6 6 B& B B3r   N)torchr   torch.distributionsr   torch.distributions.normalr   ,torch.distributions.transformed_distributionr   torch.distributions.transformsr   __all__r    r   r   <module>rA      s*     + - P 7 -63' 63r   