o
    h                     @   sf   d dl mZmZ 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 de
Zd	S )
    )OptionalUnion)Tensor)constraints)Normal)TransformedDistribution)ExpTransform	LogNormalc                	       s   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ef deeef dee d	df fd
dZd fdd	Zed	efddZed	efddZed	efddZed	efddZed	efddZdd Z  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                    s&   t |||d}t j|t |d d S )N)r   )r   super__init__r   )selfr
   r   r   r   	__class__ d/home/www/facesmatcher.com/frenv_anti/lib/python3.10/site-packages/torch/distributions/log_normal.pyr   '   s   zLogNormal.__init__c                    s   |  t|}t j||dS )N)	_instance)Z_get_checked_instancer	   r   expand)r   Zbatch_shaper   newr   r   r   r   0   s   zLogNormal.expandc                 C      | j jS N)r   r
   r   r   r   r   r
   4      zLogNormal.locc                 C   r   r   )r   r   r   r   r   r   r   8   r   zLogNormal.scalec                 C   s   | j | jdd   S N   )r
   r   powexpr   r   r   r   mean<   s   zLogNormal.meanc                 C   s   | j | j   S r   )r
   r   Zsquarer    r   r   r   r   mode@   s   zLogNormal.modec                 C   s&   | j d}| d| j |   S r   )r   r   expm1r
   r    )r   Zscale_sqr   r   r   varianceD   s   zLogNormal.variancec                 C   s   | j  | j S r   )r   entropyr
   r   r   r   r   r%   I   s   zLogNormal.entropyr   )__name__
__module____qualname____doc__r   realZpositiveZarg_constraintsZsupportZhas_rsampler   __annotations__r   r   floatr   boolr   r   propertyr
   r   r!   r"   r$   r%   __classcell__r   r   r   r   r	      s8   
 

	N)typingr   r   Ztorchr   Ztorch.distributionsr   Ztorch.distributions.normalr   Z,torch.distributions.transformed_distributionr   Ztorch.distributions.transformsr   __all__r	   r   r   r   r   <module>   s   