+
    Pj                         ^ RI Ht ^ RIHtHtHtHtHt ^ RIH	t	 ^ RI
Ht ^ RIHt ]! R4      t]]]R3,          ]],          3,          t]! ^R7      R	 R
 l4       tR R ltR R ltR R ltR# )    )	lru_cache)ListSequenceTupleTypeVarUnion)EinopsError)get_backend)ParsedExpressionTensor.)maxsizec          	      h    V ^8  d   QhR\         R\         R\        \        \        \        3,          /# )   patternopnamereturn)strr   int)formats   "g/Users/ahmed/devFolder/Ultron/claude-voice/gateway/.venv/lib/python3.14/site-packages/einops/packing.py__annotate__r      s,     1 1S 1# 1%S#2F 1    c           
         V P                  4       p\        V4      p\        V4      \        V4      8w  d   \        R V RV  R24      hRV9  d   \        RV RV  R24      hV FA  pVR8w  g   K  \        P
                  ! V4      w  rVV'       d   K.  \        RV RV RV  R24      h	  VP                  R4      p\        V4      V,
          ^,
          pWx,           p	WxV	3# )zDuplicates in axes names in z(..., "z")*zNo *-axis in zInvalid axis name z in )splitsetlenr	   r   check_axis_name_return_reasonindex)
r   r   axesaxes_setaxisis_validreasonn_axes_beforen_axes_aftermin_axess
   &&        r   analyze_patternr(      s     ==?D4yH
4yCM!8yPRSTT
(M&	DEE3;/MMdSH8!$6tfDPWyXZ"[\\	 
 JJsOMt9},q0L+H00r   c          	          V ^8  d   QhR\         \        ,          R\        R\        \        \        \
        ,          3,          /# )r   tensorsr   r   )r   r   r   r   r   Shape)r   s   "r   r   r   !   s9     6O 6O(6" 6OS 6OU64;;N5O 6Or   c                   \        VR4      w  r#p\        V ^ ,          4      p. p. p\        V 4       F  w  rVP                  V	4      p
\	        V
4      V8  d   \        RV RV
 RV RV R2	4      h\	        V
4      V,
          pVP                  WV 4       VP                  VP                  V	. V
RV OR	NWR O54      4       K  	  VP                  WbR7      V3# )
a  
Packs several tensors into one.
See einops tutorial for introduction into packing (and how it replaces stack and concatenation).

Parameters:
    tensors: tensors to be packed, can be of different dimensionality
    pattern: pattern that is shared for all inputs and output, e.g. "i j * k" or "batch seq *"

Returns:
    (packed_tensor, packed_shapes aka PS)

Example:
```python
>>> from numpy import zeros as Z
>>> inputs = [Z([2, 3, 5]), Z([2, 3, 7, 5]), Z([2, 3, 7, 9, 5])]
>>> packed, ps = pack(inputs, 'i j * k')
>>> packed.shape, ps
((2, 3, 71, 5), [(), (7,), (7, 9)])
```

In this example, axes were matched to: i=2, j=3, k=5 based on order (first, second, and last).
All other axes were 'packed' and concatenated.
PS (packed shapes) contains information about axes that were matched to '*' in every input.
Resulting tensor has as many elements as all inputs in total.

Packing can be reversed with unpack, which additionally needs PS (packed shapes) to reconstruct order.

```python
>>> inputs_unpacked = unpack(packed, ps, 'i j * k')
>>> [x.shape for x in inputs_unpacked]
[(2, 3, 5), (2, 3, 7, 5), (2, 3, 7, 9, 5)]
```

Read the tutorial for introduction and application scenarios.
packzpacked tensor #z' (enumeration starts with 0) has shape z, while pattern z assumes at least z axesN)r"   )	r(   r
   	enumerateshaper   r	   appendreshapeconcat)r*   r   r%   r&   r'   backendreshaped_tensorspacked_shapesitensorr0   axis_after_packed_axess   &&          r   r-   r-   !   s   H -<GV,L)M '!*%G%'!#Mw'	f%u: !!$KE7 S!!(	);H:UL  "%Ul!:U1GHI8u%:O8uQS8uV[\sVt8u vw ( >>*>?NNr   c                0    V ^8  d   QhR\         R\        /# )r   xr   )r+   r   )r   s   "r   r   r   Z   s      E c r   c                 ,    ^pV  F  pW,          pK  	  V# )    )r;   resultr7   s   &  r   prodr@   Z   s    F Mr   c          	      t    V ^8  d   QhR\         R\        \        ,          R\        R\        \         ,          /# )r   r8   r6   r   r   )r   r   r+   r   )r   s   "r   r   r   a   s6     \ \6 \$u+ \ \V \r   c                   \        VRR7      w  r4p\        V 4      pVP                  V 4      p\        V4      V^,           V,           8w  d   \	        RV RV 24      hTpV U	u. uF  p	RV	9   d   RM
\        V	4      NK  	  p
p	\        R V
 4       4      pV^8  d   \	        RV RV R24      h^ .\        V4      ,          Wx,          .,           pV^ 8X  d1   \        V
RR 4       F  w  rW,          V,           W^,           &   K  	  MV
P                  R4      p\        V4       F!  pW,          W,          ,           W^,           &   K#  	  \        V^,           \        V
4      4      RRR1,           F$  pVV^,           ,          V
V,          ,
          VV&   K&  	  VRV pWx^,           R p\        RR4      3V,          p \        V4       UUu. uFH  w  ppVP                  V . VO\        W,          W^,           ,          4      N5,          . VOVOVO54      NKJ  	  upp# u up	i u uppi   \         d"   p\	        R	T R
TR,           RT 24      ThRp?ii ; i)a  
Unpacks a single tensor into several by splitting over a selected axes.
See einops tutorial for introduction into packing (and how it replaces stack and concatenation).

Parameters:
    tensor: tensor to be unpacked
    packed_shapes: packed_shapes (aka PS) is a list of shapes that take place of '*' in each output.
        output will contain a single tensor for every provided shape
    pattern: pattern that is shared for input and all outputs, e.g. "i j * k" or "batch seq *",
        where * designates an axis to be unpacked

Returns:
    list of tensors

If framework supports views, results are views to the original tensor.

Example:
```python
>>> from numpy import zeros as Z
>>> inputs = [Z([2, 3, 5]), Z([2, 3, 7, 5]), Z([2, 3, 7, 9, 5])]
>>> packed, ps = pack(inputs, 'i j * k')
>>> packed.shape, ps
((2, 3, 71, 5), [(), (7,), (7, 9)])
```

In this example, axes were matched to: i=2, j=3, k=5 based on order (first, second, and last).
All other axes were 'packed' and concatenated.
PS (packed shapes) contains information about axes that were matched to '*' in every input.
Resulting tensor has as many elements as all inputs in total.

Packing can be reversed with unpack, which additionally needs PS (packed shapes) to reconstruct order.

```python
>>> inputs_unpacked = unpack(packed, ps, 'i j * k')
>>> [x.shape for x in inputs_unpacked]
[(2, 3, 5), (2, 3, 7, 5), (2, 3, 7, 9, 5)]
```

Read the tutorial for introduction and application scenarios.
unpack)r   zunpack(..., z)) received input of wrong dim with shape c              3   >   "   T F  p\        VR8H  4      x  K  	  R# 5i)r=   Nr.   )r   ).0r;   s   & r   	<genexpr>unpack.<locals>.<genexpr>   s     !Q8P1#a2g,,8Ps   z) received more than one -1 in z and can't infer dimensionsNzError during unpack(..., "z!"): could not split axis of size z into requested r.   )r(   r
   r0   r   r	   r@   sumr/   r   rangeslicer2   	Exception)r8   r6   r   r%   r&   r'   r4   input_shapeunpacked_axisp_shapelengths_of_composed_axesn_unknown_composed_axessplit_positionsr7   r;   unknown_composed_axisjshape_start	shape_endslice_fillerelement_shapees   &&&                   r   rC   rC   a   s   R -<GH,U)M&!G--'K
;=1,|;;L	1Z[fZghii&Man*oanV]w2DM+Qan*o!!Q8P!QQ"7)#B=/Qlm
 	
 cC..+2L1MMO!#6s;<DA%4%7!%;OE" = &>%C%CB%G,-A%4%7:R:U%UOE" .,q0#6N2OPQUSUQUVVA!0Q!7:RST:U!UOA W n}-KA-/0I$%'-7L %.m$<
 %= = OOYYu_-?UVQVAW'XYZ:+::	:
 %=
 	
; +p:
  (	1RSbceSfRg}o/
 	s1   "H8H# AHH# H# #I.I

IN)	functoolsr   typingr   r   r   r   r   einopsr	   einops._backendsr
   einops.parsingr   r   r   r+   r(   r-   r@   rC   r>   r   r   <module>r^      sg     8 8  ( +		eCHotCy() 31 1&6Or\r   