+
    –°³ja#  ã                   ó2  € R t ^ RIt^ RIHtHtHt ^ RIHt ^ RIt^RI	H
t
 R R lt ! R R]]4      t ! R	 R
]]4      tR R ltR R ltR&R R lltR'R R lltR R ltR R ltR R ltRR/R R lltR R ltR R ltR  R! ltR(R" R# lltR$ R% ltR# ))zKAssorted utilities, which do not need anything other than torch and stdlib.N)ÚIterableÚSequenceÚSized)Ú	TypeGuard)Ú_dtypes_implc                óF   € V ^8„  d   QhR\         R\        \        ,          /# )é   ÚseqÚreturn)Úobjectr   r   )Úformats   "ÚS/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/_numpy/_util.pyÚ__annotate__r      s   € ÷ 	ñ 	”Vð 	¤	¬%Õ 0ñ 	ó    c                 ó¢   € \        V \        4      '       d   R # \        V \        4      '       g   R #  \        V 4       R#   \         d     R # i ; i)FT)Ú
isinstanceÚstrr   ÚlenÚ	Exception)r	   s   &r   Úis_sequencer      sG   € Ü�#”s×ÒÙÜ�cœ5×!Ò!ÙðÜˆCŒñ øô ô Úðús   ²? ¿AÁAc                   ó   € ] tR t^tRtR# )Ú	AxisError© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   r   r   r   r      ó   † Ûr   r   c                   ó   € ] tR t^tRtR# )ÚUFuncTypeErrorr   Nr   r   r   r   r!   r!      r   r   r!   c                ó†   € V ^8„  d   QhR\         P                  R\         P                  R,          R\         P                  /# )r   ÚtensorÚdtypeNr
   )ÚtorchÚTensorr$   )r   s   "r   r   r   !   s2   € ÷ ñ œ5Ÿ<™<ð ´·±¸dÕ0Bð ÄuÇ|Á|ñ r   c                 óR   € Ve#   V P                   V8w  d   V P                  V4      p V # ©N)r$   Úto)r#   r$   s   &&r   Úcast_if_neededr*   !   s&   € àÒ˜VŸ\™\¨UÔ2Ø—‘˜5Ó!ˆØ€Mr   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r   Úxr
   )r%   r&   )r   s   "r   r   r   (   s"   € ÷ ñ œŸ™ð ¬%¯,©,ñ r   c                 ó¬   € \         P                  ! V P                  4      ^8  d/   V P                  \         P                  ! 4       P
                  4      p V # )r   )r   Ú	_categoryr$   r)   Údefault_dtypesÚfloat_dtype)r,   s   &r   Úcast_int_to_floatr1   (   s;   € ä×Ò˜aŸg™gÓ&¨Ô*Ø�D‰D”×,Ò,Ó.×:Ñ:Ó;ˆØ€Hr   c                óV   € V ^8„  d   QhR\         R\         R\        R,          R\         /# )r   ÚaxÚndimÚargnameNr
   )Úintr   )r   s   "r   r   r   0   s,   € ÷ ñ œSð ¬ð ´c¸Dµjð ÌCñ r   c                 ój   € V) T u;8:  d   V8  g   M \        R V  RV 24      hV ^ 8  d	   W,          p V # )zaxis z) is out of bounds for array of dimension )r   )r3   r4   r5   s   &&&r   Únormalize_axis_indexr8   0   s=   € ØˆE�RÖ˜$ÖÜ˜% ˜tÐ#LÈTÈFÐSÓTÐTØ	ˆA„vØ
�
ˆØ€Ir   c                ó¨   € V ^8„  d   QhR\         \        \         ,          ,          R\         R\        R,          R\        R\        \         R3,          /# )r   Úaxisr4   r5   NÚallow_duplicater
   .)r6   r   r   ÚboolÚtuple)r   s   "r   r   r   9   sO   € ÷ 4ñ 4Ü
”œ•Õ
ð4ä
ð4ô �4�Zð4ô ð	4ô
 Œ3�ˆ8…_ñ4r   c                óº  aa€ \        V \        \        34      '       d   T pM \        P                  ! V 4      .p\        ;QJ d    . VV3R lV 4       F  NK  	  5M! VV3R lV 4       4      pV'       gS   \        \        \        \        V4      4      4      \        V4      8w  d#   S'       d   \        RS R24      h\        R4      hV#   \
         d    T p LŸi ; i)ar  
Normalizes an axis argument into a tuple of non-negative integer axes.

This handles shorthands such as ``1`` and converts them to ``(1,)``,
as well as performing the handling of negative indices covered by
`normalize_axis_index`.

By default, this forbids axes from being specified multiple times.
Used internally by multi-axis-checking logic.

Parameters
----------
axis : int, iterable of int
    The un-normalized index or indices of the axis.
ndim : int
    The number of dimensions of the array that `axis` should be normalized
    against.
argname : str, optional
    A prefix to put before the error message, typically the name of the
    argument.
allow_duplicate : bool, optional
    If False, the default, disallow an axis from being specified twice.

Returns
-------
normalized_axes : tuple of int
    The normalized axis index, such that `0 <= normalized_axis < ndim`
c              3   ó>   <"  € T F  p\        VSS4      x € K  	  R # 5ir(   )r8   )Ú.0r3   r5   r4   s   & €€r   Ú	<genexpr>Ú'normalize_axis_tuple.<locals>.<genexpr>g   s   øé € ÐJÁT¸rÔ'¨¨D°'×:Ð:ÃTùó   ƒzrepeated axis in `z
` argumentzrepeated axis)r   r=   ÚlistÚoperatorÚindexÚ	TypeErrorr   ÚsetÚmapr6   Ú
ValueError)r:   r4   r5   r;   ÚaxesÚresults   &ff&  r   Únormalize_axis_tuplerM   9   s¯   ù€ ôH �$œ¤˜×&Ò&Ø‰ð	Ü—N’N 4Ó(Ð)ˆD÷ ŒUÕJÁTÓJ�U‰UÕJÁTÓJÓJ€Fßœs¤3¤s¬3°Ó'7Ó#8Ó9¼SÀ»[ÔHßÜÐ1°'°¸*ÐEÓFÐFä˜_Ó-Ð-Ø€Møô ô 	ØŠDð	ús   £C
 Ã
CÃCc                ó|   € V ^8„  d   QhR\         \        \         R3,          ,          R,          R\         R,          /# )r   r:   .Nr
   )r6   r=   )r   s   "r   r   r   p   s0   € ÷ ñ ¤¤u¬S°#¨X¥Õ!6¸Õ!=ð Ä#ÈÅ*ñ r   c                 ó†   € V f   V # \        V \        4      '       d   V # \        V 4      ^8w  d   \        R4      hV ^ ,          # )Nzdoes not handle tuple axis)r   r6   r   ÚNotImplementedError)r:   s   &r   Úallow_only_single_axisrQ   p   s>   € Ø‚|ØˆÜ�$œ×ÒØˆÜ
ˆ4ƒy�A„~Ü!Ð">Ó?Ð?Ø��7€Nr   c                óÄ   € V ^8„  d   QhR\         \        ,          R\        \        \        R3,          ,          \        \        ,          ,          R\        \        ,          /# )r   Ú	arr_shaper:   .r
   )r   r6   r=   rD   )r   s   "r   r   r   z   sB   € ÷ 	ñ 	Üœ�}ð	Ü$'¬%´°S°­/Õ$9¼DÄ½IÕ$Eð	ä	Œ#…Yñ	r   c                 ó
  € \        V\        \        34      '       d   TMV3p\        V4      \        V 4      ,           p\	        W#4      p\        V 4      p\        V4       Uu. uF  qfV9   d   ^M
\        V4      NK  	  ppV# u upi ©é   )r   rD   r=   r   rM   ÚiterÚrangeÚnext)rS   r:   Úaxis_seqÚout_ndimÚ
normalizedÚshape_itr3   Úshapes   &&      r   Úexpand_shaper_   z   ss   € ô " $¬¬u¨×6Ò6‰t¸T¸G€HÜ�8‹}œs 9›~Õ-€HÜ% hÓ9€JÜ�I‹€HÜAFÀxÄÓQÁ¸2˜
Ô"‰Q¬¨X«Ò6Á€EÐQØ€Lùò Rs   Á B c                ó®   € V ^8„  d   QhR\         P                  R\        \        \        R3,          ,          R,          R\        R\         P                  /# )r   r#   r:   .Nr4   r
   ©r%   r&   r6   r=   )r   s   "r   r   r   †   sF   € ÷ 
ñ 
Ü�L‰Lð
Ü #¤e¬C°¨H¥oÕ 5¸Õ <ð
ÜDGð
ä
‡\�\ñ
r   c                 ó°   € Vf+   RV,          pV P                  V4      P                  4       p V # \        V P                  V4      pV P	                  V4      p V # )NrU   )ÚexpandÚ
contiguousr_   r^   Úreshape)r#   r:   r4   r^   s   &&& r   Úapply_keepdimsrf   †   sU   € ð ‚|à�t•ˆØ—‘˜uÓ%×0Ñ0Ó2ˆð €Mô ˜VŸ\™\¨4Ó0ˆØ—‘ Ó&ˆØ€Mr   r:   c          	      ó®   € V ^8„  d   QhR\         P                  R\        R,          R\        \        \         P                  R3,          \        3,          /# )r   Útensorsr:   Nr
   .ra   )r   s   "r   r   r   “   sD   € ÷ ñ Ü�l‰lðÜ"%¨¥*ðä
Œ5”—‘˜sÐ"Õ#¤SÐ(Õ)ñr   c                óp   € V f1   \         ;QJ d    . R V 4       F  NK  	  5M! R V 4       4      pV^ 3# W3# )z#Flatten the arrays if axis is None.c              3   ó@   "  € T F  qP                  4       x € K  	  R # 5ir(   )Úflatten)r@   Úars   & r   rA   Ú$axis_none_flatten.<locals>.<genexpr>˜   s   é € Ð7©w¨Ÿ
™
Ÿ˜«wùs   ‚©r=   )r:   rh   s   $*r   Úaxis_none_flattenro   “   s9   € ð ‚|ß”%Ñ7©wÓ7—%‘%Ñ7©wÓ7Ó7ˆØ˜ˆzÐàˆ}Ðr   c                ó„   € V ^8„  d   QhR\         P                  R\         P                  R\        R\         P                  /# )r   ÚtÚtarget_dtypeÚcastingr
   )r%   r&   r$   r   )r   s   "r   r   r   ž   s8   € ÷ +ñ +Ü‡|�|ð+Ü#(§;¡;ð+Ü9<ð+ä
‡\�\ñ+r   c           	     óª   € \         P                  pV! V P                  WR7      '       g    \        RV P                   RV RV R24      h\	        W4      # )a„  Dtype-cast tensor to target_dtype.

Parameters
----------
t : torch.Tensor
    The tensor to cast
target_dtype : torch dtype object
    The array dtype to cast all tensors to
casting : str
    The casting mode, see `np.can_cast`

 Returns
 -------
`torch.Tensor` of the `target_dtype` dtype

 Raises
 ------
 ValueError
    if the argument cannot be cast according to the `casting` rule

)rs   zCannot cast array data from z to z according to the rule 'Ú')r   Úcan_cast_implr$   rG   r*   )rq   rr   rs   Úcan_casts   &&& r   Útypecast_tensorrx   ž   s^   € ô0 ×)Ñ)€Há�A—G‘G˜\×;Ó;ÜØ*¨1¯7©7¨)ð 4Øˆ~Ð5°g°Y¸aðAó
ð 	
ô ˜!Ó*Ð*r   c          
      ó´   € V ^8„  d   QhR\         \        P                  ,          R\        P                  R\        R\
        \        P                  R3,          /# )r   rh   rr   rs   r
   .)r   r%   r&   r$   r   r=   )r   s   "r   r   r   À   sM   € ÷ Mñ MÜ”e—l‘lÕ#ðMÜ38·;±;ðMÜILðMä
Œ5�<‰<˜ÐÕñMr   c                 ón   aa€ \         ;QJ d    . VV3R  lV  4       F  NK  	  5# ! VV3R  lV  4       4      # )c              3   ó>   <"  € T F  p\        VSS4      x € K  	  R # 5ir(   )rx   )r@   rq   rs   rr   s   & €€r   rA   Ú#typecast_tensors.<locals>.<genexpr>Ã   s   øé € ÐLÁG¸q”  L°'×:Ð:ÃGùrC   rn   )rh   rr   rs   s   &ffr   Útypecast_tensorsr}   À   s'   ù€ ÷ Œ5ÕLÁGÓL�5ÐLˆ5ÕLÁGÓLÓLÐLr   c                óD   € V ^8„  d   QhR\         R\        P                  /# )r   Úobjr
   )r   r%   r&   )r   s   "r   r   r   Æ   s   € ÷ ñ ¤ð ¬5¯<©<ñ r   c                 ó”   €  \         P                  ! V 4      pV#   \         d#   pR T  R\        T4       R2p\	        T4      hRp?ii ; i)zfailed to convert z! to ndarray. 
Internal error is: Ú.N)r%   Ú	as_tensorr   r   rP   )r   r#   ÚeÚmesgs   &   r   Ú_try_convert_to_tensorr…   Æ   sS   € ð(Ü—’ Ó%ˆð €Møô ô (Ø# C 5Ð(JÌ3ÈqË6È(ÐRSÐTˆÜ! $Ó'Ð'ûð(ús   ‚ šA¥AÁAc          
      óŠ   € V ^8„  d   QhR\         R\        P                  R,          R\        R\        R\        P
                  /# )r   r   r$   NÚcopyÚndminr
   )r   r%   r$   r<   r6   r&   )r   s   "r   r   r   Ï   sN   € ÷ @ñ @Ü	ð@ä�;‰;˜Õð@ô ð@ô ð	@ô
 ‡\�\ñ@r   c                óh  € \        V \        P                  4      '       d   T pMo\        P                  ! 4       p\        P                  ! \
        P                  ! \        P                  4      4        \        V 4      p\        P                  ! V4       \        WA4      pW4P                  ,
          pV^ 8”  d*   VP                  RV,          VP                  ,           4      p \        V4      pV'       d   VP                  4       pV#   \        P                  ! T4       i ; i  \         d    Rp LDi ; i)ad  The core logic of the array(...) function.

Parameters
----------
obj : tensor_like
    The thing to coerce
dtype : torch.dtype object or None
    Coerce to this torch dtype
copy : bool
    Copy or not
ndmin : int
    The results as least this many dimensions
is_weak : bool
    Whether obj is a weakly typed python scalar.

Returns
-------
tensor : torch.Tensor
    a tensor object with requested dtype, ndim and copy semantics.

Notes
-----
This is almost a "tensor_like" coercive function. Does not handle wrapper
ndarrays (those should be handled in the ndarray-aware layer prior to
invoking this function).
FrU   )r   r%   r&   Úget_default_dtypeÚset_default_dtyper   Úget_default_dtype_forÚfloat32r…   r*   r4   Úviewr^   r<   rJ   Úclone)r   r$   r‡   rˆ   r#   Údefault_dtypeÚ
ndim_extras   &&&&   r   Ú_coerce_to_tensorr’   Ï   sì   € ô@ �#”u—|‘|×$Ò$Ø‰ô ×/Ò/Ó1ˆÜ×Ò¤× BÒ BÄ5Ç=Á=Ó QÔRð	3Ü+¨CÓ0ˆFä×#Ò# MÔ2ô ˜FÓ*€Fð Ÿ™Õ$€JØ�A„~Ø—‘˜T JÕ.°·±Õ=Ó>ˆðÜ�D‹zˆ÷
 Ø—‘“ˆà€Møô) ×#Ò# MÕ2ûô ô àŠðús   Á2D Ã!D! ÄDÄ!D1Ä0D1c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úinputsr
   )r   )r   s   "r   r   r     s   € ÷ +ñ +¤ð +¬Fñ +r   c                 óÆ  € ^RI Hp \        V 4      ^ 8X  d   \        4       # \        V 4      ^8X  dq   V ^ ,          p\	        W!4      '       d   VP
                  # \	        V\        4      '       d3   . pV F  p\        V4      pVP                  V4       K!  	  \        V4      # V# \	        V \        4      '       g"   \        R\        V 4      P                   24      h\        V 4      # )zHConvert all ndarrays from `inputs` to tensors. (other things are intact))Úndarrayz#Expected inputs to be a tuple, got )Ú_ndarrayr–   r   rJ   r   r#   r=   Úndarrays_to_tensorsÚappendÚAssertionErrorÚtyper   )r”   r–   Úinput_rL   Ú	sub_inputÚ
sub_results   *     r   r˜   r˜     sÂ   € å!ä
ˆ6ƒ{�aÔÜ‹|ÐÜ	ˆV‹˜Ô	Ø˜•ˆÜ�f×&Ò&Ø—=‘=Ð Ü˜¤×&Ò&ØˆFÛ#�	Ü0°Ó;�
Ø—‘˜jÖ)ñ $ô ˜“=Ð àˆMä˜&¤%×(Ò(Ü Ø5´d¸6³l×6KÑ6KÐ5LÐMóð ô # 6Ó*Ð*r   r(   )NF)NFé    )Ú__doc__rE   Úcollections.abcr   r   r   Útypingr   r%   Ú r   r   rJ   Ú
IndexErrorr   rG   ÚRuntimeErrorr!   r*   r1   r8   rM   rQ   r_   rf   ro   rx   r}   r…   r’   r˜   r   r   r   Ú<module>r¦      s‰   ðÙ Qã ß 5Ñ 5Ý ã å õ	ô	�
˜Jô 	ô	�Y ô 	õõ÷÷4õnõ	õ
ðØ/3÷õ+õDMõ÷@÷F+r   