
    ,h                     p    S SK JrJr  S SKJr  S SKJrJr  S SKJ	r	  S SK
Jr  S SKJr  S/r " S S\5      rg	)
    )OptionalUnion)Tensor)constraintsIndependent)Normal)TransformedDistribution)StickBreakingTransformLogisticNormalc            	          ^  \ rS rSr% Sr\R                  \R                  S.r\R                  r
Sr\\   \S'    SS\\\4   S\\\4   S	\\   S
S4U 4S jjjrSU 4S jjr\S
\4S j5       r\S
\4S j5       rSrU =r$ )r      a  
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                    > [        XUS9nUR                  (       d  UR                  S/5      n[        TU ]  U[        5       US9  g )N)r      )r   batch_shapeexpandsuper__init__r
   )selfr   r   r   r   	__class__s        [/var/www/html/shao/venv/lib/python3.13/site-packages/torch/distributions/logistic_normal.pyr   LogisticNormal.__init__+   sI     3]C	$$!((!-I-/} 	 	
    c                 J   > U R                  [        U5      n[        TU ]  XS9$ )N)	_instance)_get_checked_instancer   r   r   )r   r   r   newr   s       r   r   LogisticNormal.expand8   s&    ((Cw~k~99r   c                 B    U R                   R                   R                  $ N)r   r   r   s    r   r   LogisticNormal.loc<   s    ~~''+++r   c                 B    U R                   R                   R                  $ r$   )r   r   r%   s    r   r   LogisticNormal.scale@   s    ~~''---r    r$   )__name__
__module____qualname____firstlineno____doc__r   realpositivearg_constraintssimplexsupporthas_rsampler   r   __annotations__r   r   floatr   boolr   r   propertyr   r   __static_attributes____classcell__)r   s   @r   r   r      s    . *..9M9MNO!!GK6"" )-	
65=!
 VU]#
  ~	

 

 
: ,V , , .v . .r   N)typingr   r   torchr   torch.distributionsr   r   torch.distributions.normalr   ,torch.distributions.transformed_distributionr	   torch.distributions.transformsr
   __all__r   r)   r   r   <module>rB      s.    "  8 - P A 
4., 4.r   