+
    &j2                       a  R" t)0 t ^ RIHtHt ^ RIHt ^ RIHtHtH	t	H
t
Ht ^ RIt^ RIHu Ht ^ RIHtHt ^ RIHt ^ RIHtHtHtHt Rt] ^ k . R#OtR
 R ltR R ltR R ltR$R R lltR R lt R$R R llt!]! RRR7      t"]! RRR7      t# ! R R	]	]"]#3,          4      t$ ! R R]$]"]#3,          ]%4      t&R%R R llt'R%R  R! llt(R# )&    )CallableSequence)update_wrapper)AnyFinalGenericoverloadTypeVarN)SymIntTensoris_tensor_like)_dtype_NumberDeviceNumbergox?lazy_propertyc                `    V ^8  d   QhR\         \        ,          R\        \         R3,          /# )   valuesreturn.)r   r   tuple)formats   "q/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/distributions/utils.py__annotate__r      s'     , ,6F? ,uVS[/A ,    c                    \         ;QJ d    R V  4       F  '       d   K   RM	  RM! R V  4       4      '       g   \        R4      h\         ;QJ d    R V  4       F  '       d   K   RM	  RM! R V  4       4      '       g   \        \        P                  ! 4       R7      pV  FF  p\        V\        P                  4      '       g   K%  \        VP                  VP                  R7      p M	  V  Uu. uF-  p\        V4      '       d   TM\        P                  ! V3/ VB NK/  	  pp\        P                  ! V!  # \        P                  ! V !  # u upi )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   h   "   T F(  p\        V4      ;'       g    \        V\        4      x  K*  	  R # 5iN)r   
isinstancer   .0vs   & r   	<genexpr> broadcast_all.<locals>.<genexpr>+   s'     KFq~a ::Jq'$::Fs   22FTziInput arguments must all be instances of Number, torch.Tensor or objects implementing __torch_function__.c              3   8   "   T F  p\        V4      x  K  	  R # 5i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   broadcast_allr4      s     3KFK333KFKKKG
 	
 31&13331&111"&U-D-D-F"GE%..U[[F 
 MS
LRq""AQ(B'(BBF 	 
 &&
33""F++	
s   /3Ec                    V ^8  d   QhR\         \        \        ,          ,          R\        R,          R\        R,          R\
        /# )r   shaper'   Nr)   r   )r   intr   r   r   r   )r   s   "r   r   r   =   sG     D DC&L!DD=D TMD 	Dr   c           	         \         P                  P                  4       '       dD   \         P                  ! \         P                  ! WVR 7      \         P
                  ! WVR 7      4      # \         P                  ! WVR 7      P                  4       # )r(   )r-   _C_get_tracing_statenormalzerosonesemptynormal_)r6   r'   r)   s   &&&r   _standard_normalr@   =   s`    
 xx""$$||KK6:JJu&9
 	
 ;;u&9AACCr   c                <    V ^8  d   QhR\         R\        R\         /# )r   r2   dimr   r   r7   )r   s   "r   r   r   K   s!     1 1& 1s 1v 1r   c                    V^ 8X  d   V # V P                   RV)  R,           pV P                  V4      P                  R4      # )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.
N)rE   )r6   reshapesum)r2   rB   required_shapes   && r   _sum_rightmostrI   K   sA     ax[[3$'%/N==(,,R00r   c                <    V ^8  d   QhR\         R\        R\         /# )r   logits	is_binaryr   r   bool)r   s   "r   r   r   Y   s!     	% 	%F 	%t 	% 	%r   c                n    V'       d   \         P                  ! V 4      # \        P                  ! V RR7      # )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   rE   )r-   sigmoidFsoftmax)rK   rL   s   &&r   logits_to_probsrS   Y   s'     }}V$$99V$$r   c                0    V ^8  d   QhR\         R\         /# )r   probsr   )r   )r   s   "r   r   r   e   s     - -v -& -r   c                    \         P                  ! V P                  4      P                  pV P	                  V^V,
          R7      # )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)rU   rZ   s   & r   clamp_probsr\   e   s3    , ++ekk
"
&
&C;;3AG;,,r   c                <    V ^8  d   QhR\         R\        R\         /# )r   rU   rL   r   rM   )r   s   "r   r   r      s!     
! 
!6 
!d 
!v 
!r   c                    \        V 4      pV'       d3   \        P                  ! V4      \        P                  ! V) 4      ,
          # \        P                  ! V4      # )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)rU   rL   
ps_clampeds   && r   probs_to_logitsrb      s?     U#Jyy$u{{J;'???99Z  r   TT)contravariantR)	covariantc                      a  ] tR t^t o RtV 3R lR lt]RV 3R lR ll4       t]RV 3R lR ll4       tRV 3R	 lR
 lltRtV t	R# )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.
c                <   < V ^8  d   QhRS[ S[.S[3,          RR/# r   wrappedr   Nr   rc   re   )r   __classdict__s   "r   r   lazy_property.__annotate__   s&     & &!a 0 &T &r   c                (    Wn         \        W4       R # r   )rj   r   selfrj   s   &&r   __init__lazy_property.__init__   s    )0t%r   Nc                (   < V ^8  d   QhRRRS[ RR/# )r   instanceNobj_typer   z!_lazy_property_and_property[T, R])r   )r   rl   s   "r   r   rm      s%     2 22(+2	,2r   c                    R # r    rp   rt   ru   s   &&&r   __get__lazy_property.__get__   s     /2r   c                ,   < V ^8  d   QhRS[ RS[RS[/# )r   rt   ru   r   )rc   r   re   )r   rl   s   "r   r   rm      s    BBBSBABr   c                    R # r   rw   rx   s   &&&r   ry   rz      s    ?Br   c                8   < V ^8  d   QhRS[ R,          RS[RR/# )r   rt   Nru   r   z%R | _lazy_property_and_property[T, R])rc   r   )r   rl   s   "r   r   rm      s)      D,/	0r   c                   Vf   \        V P                  4      # \        P                  ! 4       ;_uu_ 4        V P                  V4      pR R R 4       \	        WP                  P
                  X4       V#   + '       g   i     L2; ir   )_lazy_property_and_propertyrj   r-   enable_gradsetattr__name__)rp   rt   ru   r2   s   &&& r   ry   rz      s]     .t||<<  LL*E !,,//7 ! s   A33B	)rj   r   )
r   
__module____qualname____firstlineno____doc__rq   r	   ry   __static_attributes____classdictcell__rl   s   @r   r   r      sO     & & 2 2 2 BB B  r   c                   6   a  ] tR t^t o RtV 3R lR ltRtV tR# )r   zWe want lazy properties to look like multiple things.

* property when Sphinx autodoc looks
* lazy_property when Distribution validate_args looks
c                <   < V ^8  d   QhRS[ S[.S[3,          RR/# ri   rk   )r   rl   s   "r   r   (_lazy_property_and_property.__annotate__   s&     ) )!a 0 )T )r   c                0    \         P                  W4       R # r   )propertyrq   ro   s   &&r   rq   $_lazy_property_and_property.__init__   s    $(r   rw   N)r   r   r   r   r   rq   r   r   r   s   @r   r   r      s     ) )r   r   c                <    V ^8  d   QhR\         R\        R\         /# )r   matdiagr   rC   )r   s   "r   r   r      s!      F # f r   c           	     d   V P                   R,          p\        P                  P                  4       '       g+   W) 8  g   W8  d   \	        RV RV)  RV^,
           R24      h\        P
                  ! W P                  R7      pW3P                  R^4      V^,           ,           8  pV RV3,          pV# )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.
zdiag (z) provided is outside [z, z].r)   .rE   )r6   r-   r9   r:   r+   aranger)   view)r   r   nr   	tril_maskvecs   &&    r   tril_matrix_to_vecr      s    
 			"A88&&((dRi496$'>rd"QUG2NOO\\!JJ/FR+tax88I
c9n
CJr   c                <    V ^8  d   QhR\         R\        R\         /# )r   r   r   r   rC   )r   s   "r   r   r      s!      F # f r   c                   ^^V,          ,           ) ^^V,          ,           ^,          ^V P                   R,          ,          ,           ^\        V4      ,          V^,           ,          ,           R,          ,           ^,          p\        P                  ! V P                  4      P
                  p\        P                  P                  4       '       g?   \        V4      V,
          V8  d(   \        RV P                   R,           R2R,           4      h\        V\        P                  4      '       d   \        VP                  4       4      M
\        V4      pV P                  V P                   RR \        P                  ! W"34      ,           4      p\        P                  ! W P                   R7      pWUP#                  R^4      V^,           ,           8  pWRV3&   V# )	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.
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   .rE   )r6   absr-   rY   r'   rZ   r9   r:   roundr+   r    r   item	new_zerosSizer   r)   r   )r   r   r   rZ   r   r   r   s   &&     r   vec_to_tril_matrixr      sT    a$h,DLQSYYr]!22QT]dQh5OOTW
W	X		
A ++cii
 
$
$C88&&((eAhlS.@,SYYr]O;YZCD
 	
 &a66affhE!HA
--		#2QF);;
<C\\!JJ/FR+tax88IYJr   c                V    V ^8  d   Qh/ ^ \         9   d   \        \        ,          ;R&   # )r   euler_constant)__conditional_annotations__r   float)r   s   "r   r   r      s     . . 6 5e 5 /r   )r4   rS   r\   rb   r   r   r   )F)r   )*r   collections.abcr   r   	functoolsr   typingr   r   r   r	   r
   r-   torch.nn.functionalnn
functionalrQ   r   r   torch.overridesr   torch.typesr   r   r   r   r   __all__r4   r@   rI   rS   r\   rb   rc   re   r   r   r   r   r   r   )r   s   @r   <module>r      s    . . $ 9 9      * 7 7  6 5,DD1	%-4
! Ct$C4 GAqDM >)-1"5x ) r   