ó
    Eñi2  ã                   óê  • % S SK JrJr  S SKJr  S SKJrJrJrJ	r	J
r
  S SKrS SKJs  Jr  S SKJrJr  S SKJr  S SKJrJrJrJr  Sr\\   \S	'   / S
QrS\\-  S\\S4   4S jrS\\\-     S\S-  S\S-  S\4S jr S\S\S\4S jr!S*S\S\"S\4S jjr#S\S\4S jr$S*S\S\"S\4S jjr%\
" SSS9r&\
" SSS 9r' " S! S"\\&\'4   5      r( " S# S$\(\&\'4   \)5      r*S+S%\S&\S\4S' jjr+S+S(\S&\S\4S) jjr,g),é    )ÚCallableÚSequence)Úupdate_wrapper)ÚAnyÚFinalÚGenericÚoverloadÚTypeVarN)ÚSymIntÚTensor©Úis_tensor_like)Ú_dtypeÚ_NumberÚDeviceÚNumberg¶oüŒxâ?Úeuler_constant)Úbroadcast_allÚlogits_to_probsÚclamp_probsÚprobs_to_logitsÚlazy_propertyÚtril_matrix_to_vecÚvec_to_tril_matrixÚvaluesÚreturn.c                  ó  • [        S U  5       5      (       d  [        S5      e[        S U  5       5      (       d°  [        [        R                  " 5       S9nU  HB  n[        U[        R                  5      (       d  M$  [        UR                  UR                  S9n  O   U  Vs/ s H,  n[        U5      (       a  UO[        R                  " U40 UD6PM.     nn[        R                  " U6 $ [        R                  " U 6 $ s  snf )a¤  
Given a list of values (possibly containing numbers), returns a list where each
value is broadcasted based on the following rules:
  - `torch.*Tensor` instances are broadcasted as per :ref:`_broadcasting-semantics`.
  - Number instances (scalars) are upcast to tensors having
    the same size and type as the first tensor passed to `values`.  If all the
    values are scalars, then they are upcasted to scalar Tensors.

Args:
    values (list of `Number`, `torch.*Tensor` or objects implementing __torch_function__)

Raises:
    ValueError: if any of the values is not a `Number` instance,
        a `torch.*Tensor` instance, or an instance implementing __torch_function__
c              3   óf   #   • U  H'  n[        U5      =(       d    [        U[        5      v •  M)     g 7f©N)r   Ú
isinstancer   ©Ú.0Úvs     ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/distributions/utils.pyÚ	<genexpr>Ú broadcast_all.<locals>.<genexpr>+   s$   é € ÐKÂF¸qŒ~˜aÓ ×:¤J¨q´'Ó$:Ô:ÂFùs   ‚/1ziInput arguments must all be instances of Number, torch.Tensor or objects implementing __torch_function__.c              3   ó8   #   • U  H  n[        U5      v •  M     g 7fr   r   r!   s     r$   r%   r&   0   s   é € Ð1ª& QŒ~˜a× Ð ª&ùs   ‚)Údtype©r(   Údevice)ÚallÚ
ValueErrorÚdictÚtorchÚget_default_dtyper    r   r(   r*   r   ÚtensorÚbroadcast_tensors)r   ÚoptionsÚvaluer#   Ú
new_valuess        r$   r   r      sæ   € ô  ÑKÁFÓK×KÑKÜðGó
ð 	
ô Ñ1©&Ó1×1Ñ1Ü"&¬U×-DÒ-DÓ-FÑ"GˆÛˆEÜ˜%¤§¡×.Ó.Ü U§[¡[¸¿¹ÑF�Ùñ ñ
 MSó
ÚLRÀq” ×"Ñ"‰A¬¯ª°QÑ(B¸'Ñ(BÒBÉFð 	ð 
ô ×&Ò&¨
Ð3Ð3Ü×"Ò" FÐ+Ð+ùò	
s   Â"3C=Úshaper(   r*   c           	      ó  • [         R                  R                  5       (       a=  [         R                  " [         R                  " XUS9[         R
                  " XUS95      $ [         R                  " XUS9R                  5       $ )Nr)   )r.   Ú_CÚ_get_tracing_stateÚnormalÚzerosÚonesÚemptyÚnormal_)r5   r(   r*   s      r$   Ú_standard_normalr>   =   s`   € ô
 ‡x�x×"Ñ"×$Ñ$ä�|Š|Ü�KŠK˜°6Ñ:Ü�JŠJ�u°&Ñ9ó
ð 	
ô �;Š;�u°&Ñ9×AÑAÓCÐCó    r3   Údimc                 óx   • US:X  a  U $ U R                   SU*  S-   nU R                  U5      R                  S5      $ )zº
Sum out ``dim`` many rightmost dimensions of a given tensor.

Args:
    value (Tensor): A tensor of ``.dim()`` at least ``dim``.
    dim (int): The number of rightmost dims to sum out.
r   N)éÿÿÿÿrB   )r5   ÚreshapeÚsum)r3   r@   Úrequired_shapes      r$   Ú_sum_rightmostrF   K   sA   € ð ˆaƒxØˆØ—[‘[  3 $Ð'¨%Ñ/€NØ�=‰=˜Ó(×,Ñ,¨RÓ0Ð0r?   ÚlogitsÚ	is_binaryc                 óf   • U(       a  [         R                  " U 5      $ [        R                  " U SS9$ )zý
Converts a tensor of logits into probabilities. Note that for the
binary case, each value denotes log odds, whereas for the
multi-dimensional case, the values along the last dimension denote
the log probabilities (possibly unnormalized) of the events.
rB   )r@   )r.   ÚsigmoidÚFÚsoftmax)rG   rH   s     r$   r   r   Y   s'   € ö Ü�}Š}˜VÓ$Ð$Ü�9Š9�V Ñ$Ð$r?   Úprobsc                 ó|   • [         R                  " U R                  5      R                  nU R	                  USU-
  S9$ )ah  Clamps the probabilities to be in the open interval `(0, 1)`.

The probabilities would be clamped between `eps` and `1 - eps`,
and `eps` would be the smallest representable positive number for the input data type.

Args:
    probs (Tensor): A tensor of probabilities.

Returns:
    Tensor: The clamped probabilities.

Examples:
    >>> probs = torch.tensor([0.0, 0.5, 1.0])
    >>> clamp_probs(probs)
    tensor([1.1921e-07, 5.0000e-01, 1.0000e+00])

    >>> probs = torch.tensor([0.0, 0.5, 1.0], dtype=torch.float64)
    >>> clamp_probs(probs)
    tensor([2.2204e-16, 5.0000e-01, 1.0000e+00], dtype=torch.float64)

é   )ÚminÚmax)r.   Úfinfor(   ÚepsÚclamp)rM   rS   s     r$   r   r   e   s3   € ô, �+Š+�e—k‘kÓ
"×
&Ñ
&€CØ�;‰;˜3 A¨¡Gˆ;Ð,Ð,r?   c                 ó®   • [        U 5      nU(       a.  [        R                  " U5      [        R                  " U* 5      -
  $ [        R                  " U5      $ )a  
Converts a tensor of probabilities into logits. For the binary case,
this denotes the probability of occurrence of the event indexed by `1`.
For the multi-dimensional case, the values along the last dimension
denote the probabilities of occurrence of each of the events.
)r   r.   ÚlogÚlog1p)rM   rH   Ú
ps_clampeds      r$   r   r      s?   € ô ˜UÓ#€JÞÜ�yŠy˜Ó$¤u§{¢{°J°;Ó'?Ñ?Ð?Ü�9Š9�ZÓ Ð r?   ÚTT)ÚcontravariantÚR)Ú	covariantc                   ó¢   • \ rS rSrSrS\\/\4   SS4S jr\	 SSSS\
SS	4S
 jj5       r\	SS\S\
S\4S jj5       r SS\S-  S\
SS4S jjrSrg)r   é�   zä
Used as a decorator for lazy loading of class attributes. This uses a
non-data descriptor that calls the wrapped method to compute the property on
first call; thereafter replacing the wrapped method into an instance
attribute.
Úwrappedr   Nc                 ó&   • Xl         [        X5        g r   )r_   r   ©Úselfr_   s     r$   Ú__init__Úlazy_property.__init__˜   s   € Ø)0ŒÜ�tÕ%r?   ÚinstanceÚobj_typez!_lazy_property_and_property[T, R]c                 ó   • g r   © ©rb   re   rf   s      r$   Ú__get__Úlazy_property.__get__œ   s   € ð /2r?   c                 ó   • g r   rh   ri   s      r$   rj   rk   ¡   s   € Ø?Br?   z%R | _lazy_property_and_property[T, R]c                 óö   • Uc  [        U R                  5      $ [        R                  " 5          U R                  U5      nS S S 5        [	        XR                  R
                  W5        U$ ! , (       d  f       N0= fr   )Ú_lazy_property_and_propertyr_   r.   Úenable_gradÚsetattrÚ__name__)rb   re   rf   r3   s       r$   rj   rk   ¤   sZ   € ð ÑÜ.¨t¯|©|Ó<Ð<Ü×ÒÕ Ø—L‘L Ó*ˆE÷ !ä�Ÿ,™,×/Ñ/°Ô7Øˆ÷ !Õ ús   ®A*Á*
A8)r_   r   )rq   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   rY   r[   rc   r	   r   rj   Ú__static_attributes__rh   r?   r$   r   r   �   sž   † ñð& ¨!¨¨a¨Ñ 0ð &°Tô &ð à.2ñ2Øð2Ø(+ð2à	,ô2ó ð2ð ÙB ÐB¨SÐB¸AÔBó ØBð 37ñØ˜D™ðØ,/ðà	0÷ð r?   r   c                   ó6   • \ rS rSrSrS\\/\4   SS4S jrSr	g)rn   é¯   z’We want lazy properties to look like multiple things.

* property when Sphinx autodoc looks
* lazy_property when Distribution validate_args looks
r_   r   Nc                 ó.   • [         R                  X5        g r   )Úpropertyrc   ra   s     r$   rc   Ú$_lazy_property_and_property.__init__¶   s   € Ü×Ñ˜$Õ(r?   rh   )
rq   rr   rs   rt   ru   r   rY   r[   rc   rv   rh   r?   r$   rn   rn   ¯   s%   † ñð) ¨!¨¨a¨Ñ 0ð )°T÷ )r?   rn   ÚmatÚdiagc           	      ó0  • U R                   S   n[        R                  R                  5       (       d$  X* :  d  X:¼  a  [	        SU SU*  SUS-
   S35      e[        R
                  " X R                  S9nX3R                  SS5      US-   -   :  nU SU4   nU$ )	z”
Convert a `D x D` matrix or a batch of matrices into a (batched) vector
which comprises of lower triangular elements from the matrix in row order.
rB   zdiag (z) provided is outside [z, rO   z].©r*   .)r5   r.   r7   r8   r,   Úaranger*   Úview)r|   r}   Únr€   Ú	tril_maskÚvecs         r$   r   r   º   s–   € ð
 	�	‰	�"‰€AÜ�8‰8×&Ñ&×(Ñ(¨d°R«i¸4»9Ü˜6 $ Ð'>À¸r¸dÀ"ÀQÈÁUÀGÈ2ÐNÓOÐOÜ�\Š\˜!§J¡JÑ/€FØŸ™ R¨Ó+¨t°a©xÑ8Ñ8€IØ
ˆc�9ˆnÑ
€CØ€Jr?   r„   c                 óö  • SSU-  -   * SSU-  -   S-  SU R                   S   -  -   S[        U5      -  US-   -  -   S-  -   S-  n[        R                  " U R                  5      R
                  n[        R                  R                  5       (       d1  [        U5      U-
  U:”  a  [        SU R                   S    S3S	-   5      e[        U[        R                  5      (       a  [        UR                  5       5      O
[        U5      nU R                  U R                   S
S [        R                  " X"45      -   5      n[        R                  " X R                   S9nXUR#                  SS5      US-   -   :  nXSU4'   U$ )z‰
Convert a vector or a batch of vectors into a batched `D x D`
lower triangular matrix containing elements from the vector in row order.
rO   é   é   rB   é   g      à?zThe size of last dimension is z which cannot be expressed as z3the lower triangular part of a square D x D matrix.Nr   .)r5   Úabsr.   rR   r(   rS   r7   r8   Úroundr,   r    r   ÚitemÚ	new_zerosÚSizer€   r*   r�   )r„   r}   r‚   rS   r|   r€   rƒ   s          r$   r   r   È   sT  € ð ˆa�$‰h‰,ˆØ��D‘‰L˜QÑ  S§Y¡Y¨r¡]Ñ!2Ñ2°Q¼¸T»±]ÀdÈQÁhÑ5OÑOÐTWÑ
Wñ	Xà	ñ	
€Aô �+Š+�c—i‘iÓ
 ×
$Ñ
$€CÜ�8‰8×&Ñ&×(Ñ(¬e°A«h¸©l¸SÓ.@ÜØ,¨S¯Y©Y°r©]¨OÐ;YÐZØCñDó
ð 	
ô & a¬¯©×6Ñ6Œˆa�f‰f‹hŒ¼EÀ!»H€AØ
�-‰-˜Ÿ	™	 # 2˜¬¯ª°Q°FÓ);Ñ;Ó
<€CÜ�\Š\˜!§J¡JÑ/€FØŸ™ R¨Ó+¨t°a©xÑ8Ñ8€IØˆˆYˆÑØ€Jr?   )F)r   )-Úcollections.abcr   r   Ú	functoolsr   Útypingr   r   r   r	   r
   r.   Útorch.nn.functionalÚnnÚ
functionalrK   r   r   Útorch.overridesr   Útorch.typesr   r   r   r   r   ÚfloatÚ__annotations__Ú__all__Útupler   Úintr>   rF   Úboolr   r   r   rY   r[   r   rz   rn   r   r   rh   r?   r$   Ú<module>rœ      sz  ðß .Ð .Ý $ß 9Õ 9ã ß Ð ß  Ý *ß 7Ó 7ð  6€��e‘Ó 5ò€ð,˜6 F™?ð ,¨u°V¸S°[Ñ/Aô ,ðDDØ�C˜&‘LÑ!ðDà�D‰=ðDð �T‰MðDð ô	Dð1˜&ð 1 sð 1¨vô 1ñ	%˜Fð 	%¨tð 	%Àõ 	%ð-�vð - &ô -ñ4
!˜6ð 
!¨dð 
!¸võ 
!ñ ˆC˜tÑ$€ÙˆC˜4Ñ €ô�G˜A˜q˜D‘Mô ô>) -°°1°Ñ"5°xô )ñ˜Fð ¨#ð °fõ ñ˜Fð ¨#ð °fö r?   