+
    –°³jc  ã                  óv   € ^ RI Ht ^ RIHtHt ]'       d   ^ RIHt ^ RIt^RIH	t	H
t
Ht R
R R lltR R	 ltR# )é    )Úannotations)ÚAnyÚTYPE_CHECKING)ÚSequenceN)Ú_match_levelsÚDimEntryÚndim_of_levelsc               ó(   € V ^8„  d   QhRRRRRRRR/# )	é   Úargr   Ú	orig_ndimÚintÚ
allow_noneÚboolÚreturnr   © )Úformats   "ÚU/home/luca/screen-checking/.venv/lib/python3.14/site-packages/functorch/dim/_order.pyÚ__annotate__r      s(   € ÷ ñ �3ð  3ð °Dð ÀHñ ó    c                óì   € ^RI Hp V f   V'       d   \        4       # \        W4      '       d   \        V 4      # \        V \        4      '       d   V ^ 8  d   T pMW,
          p\        V4      # \        4       # )a  
Convert various dimension representations to DimEntry.

Args:
    arg: The argument to convert (Dim, int, or other)
    orig_ndim: Original number of dimensions
    allow_none: Whether to allow None values

Returns:
    DimEntry representation of the dimension
)ÚDim)Ú r   r   Ú
isinstancer   )r   r   r   r   Úposs   &&&  r   Ú	_wrap_dimr      s]   € õ à
‚{—zÜ‹zÐÜ	�C×	Ò	Ü˜‹}ÐÜ	�Cœ×	Ò	Ø�Œ7Ø‰Cà•/ˆCÜ˜‹}Ðä‹zÐr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Útensor_or_dimztorch.Tensor | AnyÚdimszAny | Sequence[Any]r   ztorch.Tensorr   )r   s   "r   r   r   *   s)   € ÷ mñ mØ%ðmØ.Aðmàñmr   c                ó	  aaa € ^RI HpHpHp \	        W4      '       d-   V P
                  R,          pV P                  pV P                  pM;\	        W4      '       d    \        V 4      .pV P                  4       pRpM\        R4      h. o. pVR,          o\        S4      o R VVV 3R llp	^ p
V EF  p\        VS R4      pVP                  4       '       g   V	! V4       V
^,          p
K:  \	        W³4      '       d0   VP                   F  pV	! \        V4      4       V
^,          p
K  	  Kz  V
^,          p
\        VR4      '       g   \        R4      h\!        V4      pVP#                  \%        S4      \%        V4      34       V F9  p\        VS R4      pVP                  4       '       d   \        R	4      hV	! V4       K;  	  EK  	  Rp. pS Fe  pVP                  4       '       d   K  VP'                  4       '       d$   VR8X  d   \%        V4      pVP)                  S4       VP#                  V4       Kg  	  VR8X  d   \%        V4      pVP)                  S4       Vf   \+        R4      h\-        WeV4      pV'       Ed†   . pVP/                  4       p\1        V4       F  pVP#                  VV,          4       K  	  ^ pV Fƒ  w  ppVV8  d+   VP#                  VVV,           ,          4       V^,          pK1  ^p\1        V4       F!  pVVVV,           V,           ,          ,          pK#  	  VP#                  V4       VV,          pK…  	  V\%        S4      8  d+   VP#                  VVV,           ,          4       V^,          pK:  \1        V\%        S4      ,           \%        S4      4       F  pVP#                  VV,          4       K  	  \%        S4      V
,
          pV^ 8”  d   VR
V VVV,           R
 ,           pVP3                  V4      p^ p\1        \%        V4      ^,
          RR4       FP  pVV,          P'                  4       '       g   VV8¼  g   K)  VVV
,           8  g   K9  V^,          p\        V4      VV&   KR  	  VP5                  VVV4      pV# )a–  
Reorder the dimensions of a tensor or create a tensor from a dimension.

It allows reordering tensor dimensions using first-class dimensions and
positional indices.

Args:
    tensor_or_dim: Input tensor with first-class dimensions, or a Dim object
    *dims: Dimensions or sequences of dimensions specifying the new order

Returns:
    Tensor with reordered dimensions

Examples:
    >>> import torch
    >>> from functorch.dim import dims
    >>> batch, channel, height, width = dims(4)
    >>> x = torch.randn(2, 3, 4, 5)[batch, channel, height, width]
    >>> # Reorder to [height, width, batch, channel]
    >>> y = order(x, height, width, batch, channel)
)r   ÚDimListÚTensor:NNNFz-First argument must be a Tensor or Dim objectc               ó    € V ^8„  d   QhRRRR/# )r   Údr   r   ÚNoner   )r   s   "r   r   Úorder.<locals>.__annotate__X   s   € ÷ 'ñ '�hð ' 4ñ 'r   c                óJ  <€  SP                  V 4      pVf[   V P                  4       '       d(   \        RS RV P                  4       S,            R24      h\        RV P	                  4        R24      h\        4       SV&   SP                  V 4       R#   \         d    Rp L�i ; i)zEAdd a dimension to the reordering, removing it from available levels.Nztensor has z positional dimensions, but z% specified, or it was specified twiceztensor does not contain dim z or it was specified twice)ÚindexÚ
ValueErrorÚis_positionalÚpositionÚdimr   Úappend)r$   ÚidxÚflat_positional_dimsÚlevelsr   s   & €€€r   Ú
append_dimÚorder.<locals>.append_dimX   s¯   ø€ ð	Ø—,‘,˜q“/ˆCð Š;Ø�‰× Ò Ü Ø! ) Ð,HÈÏÉËÐXaÕIaÐHbð c0ð 1óð ô
 !Ø2°1·5±5³7°)Ð;UÐVóð ô “jˆˆs‰Ø×#Ñ# AÖ&øô ô 	ØŠCð	ús   ƒB ÂB"Â!B"Ú__iter__z+expected a Dim, List[Dim], or Sequence[Dim]zexpected a Dim or intNzCannot reorder None tensoréÿÿÿÿ)r   r   r!   r"   r   Ú_levelsÚ_tensorÚ_has_devicer   Ú
_get_ranger)   r	   r   Úis_noneÚ_dimsÚhasattrÚlistr-   Úlenr*   ÚextendÚAssertionErrorr   ÚsizeÚrangeÚreshapeÚfrom_positional)!r   r   r   r!   r"   Úorig_levelsÚdataÚ
has_deviceÚ
to_flattenr1   Ún_new_positionalr   Úentryr,   ÚseqÚitemÚinsert_pointÚ
new_levelsÚlevelÚndataÚ
view_shapeÚsizesÚiÚ	start_idxÚlengthÚnew_sizeÚjÚn_to_removeÚseenÚresultr/   r0   r   s!   &*                            @@@r   ÚorderrZ   *   s"  ú€ ÷0 'Ñ&ô �-×(Ò(à#×+Ñ+¨AÕ.ˆØ×$Ñ$ˆØ"×.Ñ.‰
Ü	�M×	'Ò	'ä Ó.Ð/ˆØ×'Ñ'Ó)ˆØ‰
äÐHÓIÐIàÐØ€JØ˜�^€Fä˜vÓ&€I÷'ò 'ð( Ðô ˆÜ˜#˜y¨%Ó0ˆØ�}‰}�ŠÙ�uÔØ Õ!ÒÜ˜×%Ò%à—y”y�Ùœ8 C›=Ô)Ø  AÕ%Ò ó !ð
  Õ!ÐÜ˜3 
×+Ò+Ü Ð!NÓOÐOô �s“)ˆCØ×ÑœsÐ#7Ó8¼#¸c»(ÐCÔDã�Ü! $¨	°5Ó9�Ø—=‘=—?’?Ü$Ð%<Ó=Ð=Ù˜5Ö!ô	 ñ) ð6 €LØ!#€Jó ˆØ�=‰=�?Š?ÙØ×Ñ× Ò Ø˜rÔ!Ü" :›�Ø×!Ñ!Ð"6Ô7Ø×Ñ˜%Ö ñ ð �rÔÜ˜:“ˆØ×ÑÐ.Ô/ð ‚|ÜÐ9Ó:Ð:Ü˜$¨ZÓ8€E÷ €zàˆ
Ø—
‘
“ˆô �|Ö$ˆAØ×Ñ˜e A�hÖ'ñ %ð ˆÛ!+ÑˆI�và�i”-Ø×!Ñ! %¨°qÕ(8Õ"9Ô:Ø�Q•’ð ˆHÜ˜6–]�Ø˜E ,°Õ"2°QÕ"6Õ7Õ7’ñ #à×Ñ˜hÔ'Ø��KŠAñ ",ð ”#Ð*Ó+Ô+Ø×Ñ˜e L°1Õ$4Õ5Ô6Ø��FŠAô �|¤cÐ*>Ó&?Õ?ÄÀVÃÖMˆAØ×Ñ˜e A�hÖ'ñ Nô Ð.Ó/Ð2BÕBˆØ˜Œ?ð ˜=˜LÐ)¨J°|ÀkÕ7QÐ7SÐ,TÕTð ð —‘˜jÓ)ˆð €DÜ”3�z“? QÕ&¨¨BÖ/ˆØ�a�=×&Ñ&×(Ò(Ø�Ö ! lÐ5EÕ&EÖ"Eà�A�IˆDÜ$ T›NˆJ�q‹Mñ 0ð ×#Ñ# E¨:°zÓB€FØ€Mr   )T)Ú
__future__r   Útypingr   r   Úcollections.abcr   ÚtorchÚ
_dim_entryr   r   r	   r   rZ   r   r   r   Ú<module>r`      s'   ðÝ "ç %÷ Ý(ã ç ?Ñ ?÷÷8mr   