
    /j                     h    d dl mZ d dlmZ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Independent)Normal)TransformedDistribution)StickBreakingTransformLogisticNormalc            	            e Zd ZU dZej        ej        dZej        Z	dZ
e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 xZS )r	   a9  
    Creates a logistic-normal distribution parameterized by :attr:`loc` and :attr:`scale`
    that define the base `Normal` distribution transformed with the
    `StickBreakingTransform` such that::

        X ~ LogisticNormal(loc, scale)
        Y = log(X / (1 - X.cumsum(-1)))[..., :-1] ~ Normal(loc, scale)

    Args:
        loc (float or Tensor): mean of the base distribution
        scale (float or Tensor): standard deviation of the base distribution

    Example::

        >>> # logistic-normal distributed with mean=(0, 0, 0) and stddev=(1, 1, 1)
        >>> # of the base Normal distribution
        >>> # xdoctest: +IGNORE_WANT("non-deterministic")
        >>> m = LogisticNormal(torch.tensor([0.0] * 3), torch.tensor([1.0] * 3))
        >>> m.sample()
        tensor([ 0.7653,  0.0341,  0.0579,  0.1427])

    )locscaleT	base_distNr   r   validate_argsreturnc                     t          |||          }|j        s|                    dg          }t                                          |t                      |           d S )N)r      )r   batch_shapeexpandsuper__init__r   )selfr   r   r   r   	__class__s        h/home/longshao/multi-rider-rag/.venv/lib/python3.11/site-packages/torch/distributions/logistic_normal.pyr   zLogisticNormal.__init__,   sr     3]CCC	$ 	.!((!--I-//} 	 	
 	
 	
 	
 	
    c                     |                      t          |          }t                                          ||          S )N)	_instance)_get_checked_instancer	   r   r   )r   r   r   newr   s       r   r   zLogisticNormal.expand9   s2    ((CCww~~kS~999r   c                 $    | j         j         j        S N)r   r   r   s    r   r   zLogisticNormal.loc=   s    ~'++r   c                 $    | j         j         j        S r   )r   r   r    s    r   r   zLogisticNormal.scaleA   s    ~'--r   r   )__name__
__module____qualname____doc__r   realpositivearg_constraintssimplexsupporthas_rsampler   r   __annotations__r   floatboolr   r   propertyr   r   __classcell__)r   s   @r   r	   r	      s$         . *.9MNNO!GK6"""" &*	
 
e^
 ~
 d{	

 

 
 
 
 
 
: : : : : : ,V , , , X, .v . . . X. . . . .r   N)torchr   torch.distributionsr   r   torch.distributions.normalr   ,torch.distributions.transformed_distributionr   torch.distributions.transformsr   __all__r	    r   r   <module>r8      s          8 8 8 8 8 8 8 8 - - - - - - P P P P P P A A A A A A 
6. 6. 6. 6. 6., 6. 6. 6. 6. 6.r   