ó
    EñiJÚ  ã                   ó:  • S SK r S SKrS SKrS SKrS SKJr  S SKJr  S SKJ	r	J
r
  S SKJrJrJr  S SKrS SKJrJrJrJrJrJrJrJrJrJrJrJr  SSKJr  \(       a  S S	KJ r   S S
K!J"r"  S SK#J$r$J%r%  / SQr&\RN                  " \(5      r) " S S\
5      r*\ RV                   " S S5      5       r, " S S5      r-\-r. " S S\-5      r/ " S S\-5      r0SSS.S\1S\2S-  S\2S-  S\3\-S4   4S jjr4\ RV                   " S S5      5       r5\ RV                   " S  S!\55      5       r6\ RV                   " S" S#5      5       r7\ RV                   " S$ S%\55      5       r8\ RV                   " S& S'\55      5       r9\6\8-  \9-  r:\ RV                   " S( S)5      5       r;S*\:S+\\2\2/\<S,   4   S-S.S\=\1\3\2\24   4   S/\<\3S0      S1\<\3S,\S2   \4      S3\=\1S44   S5\>S,   4S6 jr?SS7.S8\S\4   S9\S:\S;\1S-  S\4
S< jjr@S\=\1\4   4S= jrA " S> S?5      rB " S@ SA5      rCSB rDSC\=\1\4   S:\=\1\4   \3\   -  \<\   -  S-  4SD jrESC\=\1\4   S:\=\1\4   \3\   -  \<\   -  S-  S\<\:   4SE jrFS:\=\1\4   \3\   -  \<\   -  S-  4SF jrGSG\1S:\=\1\4   \3\   -  \<\   -  S\=\1\4   \3\   -  \<\   -  4SH jrHg)Ié    N)Údefaultdict)ÚCallable)ÚautoÚEnum)ÚAnyÚTYPE_CHECKINGÚUnion)Ú_get_node_typeÚBUILTIN_TYPESÚKeyPathÚkeystrÚ
MappingKeyÚSequenceKeyÚSUPPORTED_NODESÚ	tree_iterÚtree_mapÚtree_map_with_pathÚtree_structureÚTreeSpecé   )ÚExportedProgram)ÚSymbol)ÚSource)ÚShapeEnvÚStrictMinMaxConstraint)Ú
ConstraintÚDimÚdimsÚ*refine_dynamic_shapes_from_suggested_fixesÚAdditionalInputsc                   óB   • \ rS rSrSr\" 5       r\" 5       r\" 5       rSr	g)Ú_DimHintTypeé0   zÈ
Enum for dynamic shape hints.
- AUTO means automatic inference of shape (static or dynamic).
- STATIC means static shape (always specialized).
- DYNAMIC means dynamic, will error out if specialized.
© N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚAUTOÚSTATICÚDYNAMICÚ__static_attributes__r$   ó    ÚX/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/export/dynamic_shapes.pyr"   r"   0   s   † ññ ‹6€DÙ‹V€FÙ‹fƒGr.   r"   c                   ó¤   • \ rS rSr% Sr\\S'   Sr\S-  \S'   Sr	\S-  \S'   Sr
\S-  \S'   \S	 5       r\S
 5       r\S 5       rSSS jjrS rSrg)Ú_DimHinté=   aN  
Internal class for dynamic shape hints.
- min and max are optional.
- _factory is for UX only, below example:
    auto_hint = _DimHint.AUTO()  # _factory=True
    bounded_hint = auto_hint(min=10, max=100)  # Returns new instance with _factory=False
    bounded_hint(min=5, max=50)  # Will fail, non-factory instance cannot be called
ÚtypeNÚminÚmaxTÚ_factoryc                  ó4   • [        [        R                  5      $ ©N)r1   r"   r*   r$   r.   r/   r*   Ú_DimHint.AUTOM   s   € äœ×)Ñ)Ó*Ð*r.   c                  ó4   • [        [        R                  5      $ r8   )r1   r"   r,   r$   r.   r/   r,   Ú_DimHint.DYNAMICQ   s   € äœ×,Ñ,Ó-Ð-r.   c                  ó4   • [        [        R                  5      $ r8   )r1   r"   r+   r$   r.   r/   r+   Ú_DimHint.STATICU   s   € äœ×+Ñ+Ó,Ð,r.   c                 ó  • U R                   (       d  [        S[        U 5       S35      eUb  US:  a  [        SU 35      eUb  US:  a  [        SU 35      eUb  Ub  X:”  a  [        SU SU 35      e[	        U R                  XSS	9$ )
NÚ'z' object is not callabler   zmin must be non-negative, got zmax must be non-negative, got zmin must be <= max, got min=ú, max=F)r4   r5   r6   )r6   Ú	TypeErrorr3   ÚAssertionErrorr1   )Úselfr4   r5   s      r/   Ú__call__Ú_DimHint.__call__Y   s—   € Ø�}�}Ü˜a¤ T£
˜|Ð+CÐDÓEÐEØ‰?˜s Q›wÜ Ð#AÀ#ÀÐ!GÓHÐHØ‰?˜s Q›wÜ Ð#AÀ#ÀÐ!GÓHÐHØ‰?˜s™°3³9Ü Ð#?À¸uÀFÈ3È%Ð!PÓQÐQÜ˜Ÿ	™	 s¸eÑDÐDr.   c                 ó  • U R                   R                  /nU R                  b  UR                  SU R                   35        U R                  b  UR                  SU R                   35        SSR                  U5       S3$ )Nzmin=zmax=zDimHint(z, Ú))r3   Únamer4   Úappendr5   Újoin)rC   Úpartss     r/   Ú__repr__Ú_DimHint.__repr__d   sm   € Ø—‘—‘Ð ˆØ�8‰8ÑØ�L‰L˜4 §¡˜zÐ*Ô+Ø�8‰8ÑØ�L‰L˜4 §¡˜zÐ*Ô+Ø˜$Ÿ)™) EÓ*Ð+¨1Ð-Ð-r.   r$   ©NN)Úreturnr1   )r%   r&   r'   r(   r)   r"   Ú__annotations__r4   Úintr5   r6   ÚboolÚstaticmethodr*   r,   r+   rD   rL   r-   r$   r.   r/   r1   r1   =   s~   ‡ ñð ÓØ€Cˆˆt‰ÓØ€Cˆˆt‰ÓØ €Hˆd�T‰kÓ àñ+ó ð+ð ñ.ó ð.ð ñ-ó ð-ö	Eõ.r.   r1   c            	       ó"  • \ rS rSrSr\R                  5       r\R                  5       r\R                  5       rSSS.S\	S\
S-  S\
S-  4S jjrSS
 jrSS jrSS jrSS jrSS jrSS jrS	\	4S jrSS jr\S\	S\
S\
S	\	4S j5       rS rSrg)r   ém   a—	  
The ``Dim`` class allows users to specify dynamism in their exported
programs. By marking a dimension with a ``Dim``, the compiler associates the
dimension with a symbolic integer containing a dynamic range.

The API can be used in 2 ways: Dim hints (i.e. automatic dynamic shapes:
``Dim.AUTO``, ``Dim.DYNAMIC``, ``Dim.STATIC``), or named Dims (i.e.
``Dim("name", min=1, max=2)``).

Dim hints provide the lowest barrier to exportability, with the user only
needing to specify if a dimension if dynamic, static, or left for the
compiler to decide (``Dim.AUTO``). The export process will automatically
infer the remaining constraints on min/max ranges and relationships between
dimensions.

Example::

    class Foo(nn.Module):
        def forward(self, x, y):
            assert x.shape[0] == 4
            assert y.shape[0] >= 16
            return x @ y


    x = torch.randn(4, 8)
    y = torch.randn(8, 16)
    dynamic_shapes = {
        "x": {0: Dim.AUTO, 1: Dim.AUTO},
        "y": {0: Dim.AUTO, 1: Dim.AUTO},
    }
    ep = torch.export(Foo(), (x, y), dynamic_shapes=dynamic_shapes)

Here, export would raise an exception if we replaced all uses of ``Dim.AUTO`` with ``Dim.DYNAMIC``,
as ``x.shape[0]`` is constrained to be static by the model.

More complex relations between dimensions may also be codegened as runtime assertion nodes by the compiler,
e.g. ``(x.shape[0] + y.shape[1]) % 4 == 0``, to be raised if runtime inputs do not satisfy such constraints.

You may also specify min-max bounds for Dim hints, e.g. ``Dim.AUTO(min=16, max=32)``, ``Dim.DYNAMIC(max=64)``,
with the compiler inferring the remaining constraints within the ranges. An exception will be raised if
the valid range is entirely outside the user-specified range.

Named Dims provide a stricter way of specifying dynamism, where exceptions are raised if the compiler
infers constraints that do not match the user specification. For example, exporting the previous
model, the user would need the following ``dynamic_shapes`` argument::

    s0 = Dim("s0")
    s1 = Dim("s1", min=16)
    dynamic_shapes = {
        "x": {0: 4, 1: s0},
        "y": {0: s0, 1: s1},
    }
    ep = torch.export(Foo(), (x, y), dynamic_shapes=dynamic_shapes)

Named Dims also allow specification of relationships between dimensions, up
to univariate linear relations.  For example, the following indicates one
dimension is a multiple of another plus 4::

    s0 = Dim("s0")
    s1 = 3 * s0 + 4

N©r4   r5   rH   r4   r5   c                óÂ   • SSK Jn  Uc  SOUnUc  UOUnXe:”  d  [        SU SU 35      eUR                  5       (       d  [        SU 35      eXl        XPl        X`l        g )Nr   ©Úint_ooz(Cannot create Dim with inconsistent min=r@   z)Dim name must be a valid identifier, got )Útorch.utils._sympy.numbersrY   rB   Úisidentifierr%   r4   r5   )rC   rH   r4   r5   rY   Ú_minÚ_maxs          r/   Ú__init__ÚDim.__init__±   sp   € Ý5à‘K‰q SˆØ™‰v¨#ˆØ“Ü Ø:¸3¸%¸vÀcÀUÐKóð ð × Ñ ×"Ñ"Ü Ð#LÈTÈFÐ!SÓTÐTØŒØŒØ�r.   rO   c                 óŠ   ^• [        T5      [        La  [        ST SU R                   S35      eU R	                  U4S j5      $ )NzAttempted to add z to úm, where an integer was expected. (Only increasing linear operations with integer coefficients are supported.)c                 ó   >• U T-   $ r8   r$   ©ÚxÚothers    €r/   Ú<lambda>ÚDim.__add__.<locals>.<lambda>Ç   ó	   ø€  a¨%¢ir.   ©r3   rQ   ÚNotImplementedErrorr%   Ú_derive©rC   re   s    `r/   Ú__add__ÚDim.__add__À   sK   ø€ ä�‹;œcÒ!Ü%Ø# E 7¨$¨t¯}©}¨oð >_ð _óð ð �|‰|Ô/Ó0Ð0r.   c                 ó
   • X-   $ r8   r$   rl   s     r/   Ú__radd__ÚDim.__radd__É   ó
   € Ø‰|Ðr.   c                 óŠ   ^• [        T5      [        La  [        ST SU R                   S35      eU R	                  U4S j5      $ )NzAttempted to subtract z from ra   c                 ó   >• U T-
  $ r8   r$   rc   s    €r/   rf   ÚDim.__sub__.<locals>.<lambda>Ó   rh   r.   ri   rl   s    `r/   Ú__sub__ÚDim.__sub__Ì   sL   ø€ ä�‹;œcÒ!Ü%Ø(¨¨¨v°d·m±m°_ð E_ð _óð ð �|‰|Ô/Ó0Ð0r.   c                 ó4   • [        SU R                   S35      e)NzAttempted to negate zN. (Only increasing linear operations with integer coefficients are supported.))rj   r%   rl   s     r/   Ú__rsub__ÚDim.__rsub__Õ   s&   € Ü!Ø" 4§=¡= /ð 2[ð [ó
ð 	
r.   c                 ó–   ^• [        T5      [        Ld  TS::  a  [        ST SU R                   S35      eU R	                  U4S j5      $ )Nr   zAttempted to multiply z with zu, where a positive integer was expected. (Only increasing linear operations with integer coefficients are supported.)c                 ó   >• U T-  $ r8   r$   rc   s    €r/   rf   ÚDim.__mul__.<locals>.<lambda>â   rh   r.   ri   rl   s    `r/   Ú__mul__ÚDim.__mul__Û   sR   ø€ ä�‹;œcÒ! U¨a£ZÜ%Ø(¨¨¨v°d·m±m°_ð E_ð _óð ð �|‰|Ô/Ó0Ð0r.   c                 ó
   • X-  $ r8   r$   rl   s     r/   Ú__rmul__ÚDim.__rmul__ä   rr   r.   c                 óP   • SSK Jn  [        U" U" U R                  5      5      5      $ )Nr   )Úsympify)Úsympyr„   Ústrr%   )rC   Úfnr„   s      r/   Ú_derived_nameÚDim._derived_nameç   s   € Ý!ä‘2‘g˜dŸm™mÓ,Ó-Ó.Ð.r.   c                 ó8   • [        U R                  U5      X5      $ r8   )Ú_DerivedDimrˆ   ©rC   r‡   s     r/   rk   ÚDim._deriveì   s   € Ü˜4×-Ñ-¨bÓ1°4Ó<Ð<r.   Úmin_Úmax_c                 óŒ   • SSK Jn  US:X  a  S nX#:X  a  S nUc	  Uc  SU  S3$ Uc	  SU  SU S3$ Uc	  SU  SU S3$ SU  SU S	U S3$ )
Nr   rX   é   zDim('z')z', max=rG   z', min=r@   )rZ   rY   )rH   rŽ   r�   rY   s       r/   Ú	_readableÚDim._readableï   s‚   € å5à�1‹9ØˆDØ‹>ØˆDØ‰<˜D™LØ˜4˜& Ð#Ð#Ø‰<Ø˜4˜& ¨ v¨QÐ/Ð/Ø‰<Ø˜4˜& ¨ v¨QÐ/Ð/Ø�t�f˜G D 6¨°¨v°QÐ7Ð7r.   c                 ól   • [         R                  U R                  U R                  U R                  5      $ r8   )r   r’   r%   r4   r5   ©rC   s    r/   rL   ÚDim.__repr__ÿ   s!   € Ü�}‰}˜TŸ]™]¨D¯H©H°d·h±hÓ?Ð?r.   )r%   r5   r4   )rO   r   )r%   r&   r'   r(   r)   r1   r*   r,   r+   r†   rQ   r^   rm   rp   rv   ry   r~   r�   rˆ   rk   rS   r’   rL   r-   r$   r.   r/   r   r   m   s»   † ñ=ð~ �=‰=‹?€DØ×ÑÓ €GØ�_‰_Ó€Fà7;Ètò ˜Sð ¨#°©*ð À#ÈÁ*õ ô1ôô1ô
ô1ôð/ 3ô /ô
=ð ð8˜ð 8 3ð 8¨cð 8°có 8ó ð8õ@r.   r   c                   óF   • \ rS rSrSrS\4S jr\S 5       r\S 5       r	Sr
g)	Ú
_StaticDimi  z–
Class for static :func:`Dim` types.

This class is only for setting and checking static dim constraints,
and the user should never interact with it.
Úvaluec                 ó0   • [        U5      U l        Xl        g r8   )r†   r%   r™   )rC   r™   s     r/   r^   Ú_StaticDim.__init__  s   € Ü˜E›
ˆŒØ�
r.   c                 ó   • U R                   $ r8   ©r™   r•   s    r/   r4   Ú_StaticDim.min  ó   € à�z‰zÐr.   c                 ó   • U R                   $ r8   r�   r•   s    r/   r5   Ú_StaticDim.max  rŸ   r.   )r%   r™   N)r%   r&   r'   r(   r)   rQ   r^   Úpropertyr4   r5   r-   r$   r.   r/   r˜   r˜     s;   † ñð˜cô ð ñó ðð ñó ór.   r˜   c                   óZ   • \ rS rSrSrS\S\S\4S jr\	S 5       r
\	S 5       rS	 rS
 rSrg)r‹   i  aé  
Class for derived :func:`Dim` types.

Currently we only support increasing linear expressions with integer coefficients.
In other words, a derived Dim can always be written in the form Ax + B, where
x is a regular Dim (i.e., non-derived Dim), A and B are integers, and A is positive.
(In particular, the latter ensures that x < y => Ax + B < Ay + B.)
These restrictions on the form of derived Dims makes the metatheory simpler: e.g.,
it simplifies computing ranges for derived Dims, solving for underlying regular Dims,
deciding equalities between derived Dims, and so on.

The function lambda x: Ax + B is expressed by `fn`, where x is a normal Dim, `root`.
The range of a derived Dim is computed by mapping `fn` over the range of its `root`.
rH   Úrootr‡   c                 ó(   • Xl         X l        X0l        g r8   )r%   r¤   r‡   )rC   rH   r¤   r‡   s       r/   r^   Ú_DerivedDim.__init__+  s   € ØŒØŒ	Ø�r.   c           	      óJ  • SSK Jn  SSKJn  U R                  R
                  U* L a  U* $ U R                  U" U R                  R
                  5      5      nU R                  nUS:  a3  [        SU R                   SUR                   SUR
                   S35      e[        U5      $ )Nr   ©ÚIntegerrX   zExpected derived min value of z9 to be >= 0. Please specify an appropriate min value for ú (currently ú).)
r…   r©   rZ   rY   r¤   r4   r‡   rB   r%   rQ   )rC   r©   rY   Ú_min_symintr¤   s        r/   r4   Ú_DerivedDim.min0  s˜   € õ 	"å5à�9‰9�=‰=˜V˜GÒ#Ø�7ˆNà—g‘g™g d§i¡i§m¡mÓ4Ó5ˆØ�y‰yˆØ˜‹?Ü Ø0°·±°ð @?Ø?C¿}¹}¸oð NØ"Ÿh™h˜Z rð+óð ô
 �;ÓÐr.   c                 ó�  • SSK Jn  SSKJn  U R                  R
                  UL a  U$ U R                  U" U R                  R
                  5      5      nU R                  nU[        R                  S-
  :”  aG  [        SU R                   S[        R                  S-
   SUR                   SUR
                   S	3	5      e[        U5      $ )
Nr   r¨   rX   r   zExpected derived max value of z
 to be <= z.. Please specify an appropriate max value for rª   r«   )r…   r©   rZ   rY   r¤   r5   r‡   ÚsysÚmaxsizerB   r%   rQ   )rC   r©   rY   Ú_max_symintr¤   s        r/   r5   Ú_DerivedDim.maxE  s­   € õ 	"å5à�9‰9�=‰=˜FÒ"ØˆMà—g‘g™g d§i¡i§m¡mÓ4Ó5ˆØ�y‰yˆØœŸ™ q™Ó(Ü Ø0°·±°¸zÌ#Ï+É+ÐXYÉ/ÐIZð [?Ø?C¿}¹}¸oð NØ"Ÿh™h˜Z rð+óð ô
 �;ÓÐr.   c                 ó\   ^ ^• [        T R                  T5      T R                  UU 4S j5      $ )Nc                 ó2   >• T" TR                  U 5      5      $ r8   )r‡   )rd   r‡   rC   s    €€r/   rf   Ú%_DerivedDim._derive.<locals>.<lambda>a  s   ø€ ‘b˜Ÿ™ ›”nr.   )r‹   rˆ   r¤   rŒ   s   ``r/   rk   Ú_DerivedDim._deriveZ  s*   ù€ ô Ø×Ñ˜rÓ"Ø�I‰IÝ$ó
ð 	
r.   c                 ó   • U R                   $ r8   )r%   r•   s    r/   rL   Ú_DerivedDim.__repr__d  s   € Ø�}‰}Ðr.   )r%   r‡   r¤   N)r%   r&   r'   r(   r)   r†   r   r   r^   r¢   r4   r5   rk   rL   r-   r$   r.   r/   r‹   r‹     sS   † ñð˜Sð ¨ð °ô ð
 ñ ó ð ð( ñ ó ð ò(
õr.   r‹   rV   Únamesr4   r5   rO   .c                 ó2   ^ ^• [        UU 4S jU 5       5      $ )zX
Util to create multiple :func:`Dim` types.

Returns:
    A tuple of :func:`Dim` types.
c              3   ó:   >#   • U  H  n[        UTTS 9v •  M     g7f)rV   N)r   )Ú.0rH   r5   r4   s     €€r/   Ú	<genexpr>Údims.<locals>.<genexpr>q  s   øé € Ð?º°”�T˜s¨Ö,ºùs   ƒ)Útuple)r4   r5   r¹   s   `` r/   r   r   h  s   ù€ ô Õ?¹Ó?Ó?Ð?r.   c                   ó.   • \ rS rSr% Sr\\S'   \\S'   Srg)Ú_ConstraintTargetit  z*
This represents input tensor dimensions.
Út_idÚdimr$   N)r%   r&   r'   r(   r)   rQ   rP   r-   r$   r.   r/   rÁ   rÁ   t  s   ‡ ñð ƒIØ	†Hr.   rÁ   c                   óf   • \ rS rSr% Sr\\S'   S\S'   SS jrS rS	 r	S
 r
S rS r\S 5       rSrg)Ú_Constrainti~  z’
This represents a Dim describing a constraint target.

`name` is the name of the Dim.
`constraint_range` contains the min/max bounds of the Dim.
rH   r   Úconstraint_rangeNc                 óÌ   • SSK Jn  SSKJn  SSKJn  Uc  UnU" U R                  R                  U" XS9-  SS9n[        U R                  U R                  U R                  U5      $ )Nr   ©r   rX   ©ÚValueRanges©ÚlowerÚupperF©ÚvrÚ	warn_only)Ú%torch.fx.experimental.symbolic_shapesr   rZ   rY   Útorch.utils._sympy.value_rangesrÊ   rÆ   rÏ   rÅ   rÂ   rÃ   rH   )rC   rÌ   rÍ   r   rY   rÊ   rÆ   s          r/   Ú_clone_with_rangeÚ_Constraint._clone_with_rangeŠ  sc   € åPÝ5Ý?à‰=ØˆEá1Ø×$Ñ$×'Ñ'©+¸EÑ*OÑOØñ
Ðô Ø�I‰IØ�H‰HØ�I‰IØó	
ð 	
r.   c                 ó    • U R                  US9$ )N©rÌ   ©rÓ   ©rC   rÌ   s     r/   Ú__ge__Ú_Constraint.__ge__ž  ó   € Ø×%Ñ%¨EÐ%Ð2Ð2r.   c                 ó&   • U R                  US-   S9$ )Nr   rÖ   r×   rØ   s     r/   Ú__gt__Ú_Constraint.__gt__¡  ó   € Ø×%Ñ%¨E°A©IÐ%Ð6Ð6r.   c                 ó    • U R                  US9$ )N©rÍ   r×   ©rC   rÍ   s     r/   Ú__le__Ú_Constraint.__le__¤  rÛ   r.   c                 ó&   • U R                  US-
  S9$ )Nr   rá   r×   râ   s     r/   Ú__lt__Ú_Constraint.__lt__§  rß   r.   c                 ó   • [        S5      e)NzšCannot determine truth value of _Constraint. If you are trying to combine _Constraint's with logical connectives, you can specify them separately instead.)rA   r•   s    r/   Ú__bool__Ú_Constraint.__bool__ª  s   € ô
 ð7ó
ð 	
r.   c                 ó°   • U R                   U R                  U R                  R                  R                  U R                  R                  R
                  S.$ ©N)rÂ   rÃ   r4   r5   ©rÂ   rÃ   rÆ   rÏ   rÌ   rÍ   r•   s    r/   Úserializable_specÚ_Constraint.serializable_specµ  sF   € ð —I‘IØ—8‘8Ø×(Ñ(×+Ñ+×1Ñ1Ø×(Ñ(×+Ñ+×1Ñ1ñ	
ð 	
r.   r$   )r   N)r%   r&   r'   r(   r)   r†   rP   rÓ   rÙ   rÝ   rã   ræ   ré   r¢   rî   r-   r$   r.   r/   rÅ   rÅ   ~  sF   ‡ ñð ƒIØ.Ó.ô
ò(3ò7ò3ò7ò	
ð ñ
ó ó
r.   rÅ   c                   ó8   • \ rS rSr% Sr\\S'   S\S'   \\S'   Srg)	Ú_PhantomRootiÆ  a˜  
This represents the root of a derived Dim where the root does not directly
specify the shape of any input dimension, but the derived Dim does.

e.g., the input shapes 2*dim and dim + 1 are related via a "phantom" dim.

The fields `name`, `constraint_range`, and `val` carried by a phantom root
help create a symbol for it. Any derived dims with this phantom root are
backed by expressions over this symbol.
rH   r   rÆ   Úvalr$   N)	r%   r&   r'   r(   r)   r†   rP   rQ   r-   r$   r.   r/   rñ   rñ   Æ  s   ‡ ñ	ð ƒIØ.Ó.Ø	†Hr.   rñ   c                   óX   • \ rS rSr% Sr\\S'   S\S'   \\-  \S'   \	\S'   \
S 5       rS	rg
)Ú_DerivedConstraintiØ  a+  
This represents a derived Dim, whose root is either a regular constraint target
(which directly specifies the shape of some input dimension) or a phantom root
(which does so indirectly).

It can be thought of as a subclass of `_Constraint`, except that it does not
support <, <=, >, >= operations.
rH   r   rÆ   r¤   r‡   c                 ó°   • U R                   U R                  U R                  R                  R                  U R                  R                  R
                  S.$ rì   rí   r•   s    r/   rî   Ú$_DerivedConstraint.serializable_specè  sF   € ð —I‘IØ—8‘8Ø×(Ñ(×+Ñ+×1Ñ1Ø×(Ñ(×+Ñ+×1Ñ1ñ	
ð 	
r.   r$   N)r%   r&   r'   r(   r)   r†   rP   rÁ   rñ   r   r¢   rî   r-   r$   r.   r/   rô   rô   Ø  s6   ‡ ñð ƒIØ.Ó.Ø
˜lÑ
*Ó*ØƒLàñ
ó ó
r.   rô   c                   ó(   • \ rS rSrSr\S 5       rSrg)Ú_RelaxedConstraintió  as  
This represents a dim marked with Dim.AUTO/DYNAMIC (i.e. mark_dynamic() or maybe_mark_dynamic()),
which leaves relations & min/max ranges for inference, instead of requiring explicit specification.
The intention is for constraint violations to not be raised if produce_guards() finds equalities or
relations between a _RelaxedConstraint and another type of _Constraint.
c                 ó4   • U R                   U R                  S.$ )N©rÂ   rÃ   rú   r•   s    r/   rî   Ú$_RelaxedConstraint.serializable_specü  s   € ð —I‘IØ—8‘8ñ
ð 	
r.   r$   N)r%   r&   r'   r(   r)   r¢   rî   r-   r$   r.   r/   rø   rø   ó  s   † ñð ñ
ó ó
r.   rø   c                   ó\   • \ rS rSr% Sr\\S'   \R                  " SSS9r	\
\-  S-  \S'   Srg)	Ú_IntWrapperi  z¢
Dummy wrapper class to wrap around integer inputs so that when we parse the
dynamic_shapes structure, we can mark if any of the integers were marked as
dynamic.
rò   FN)ÚinitÚdefaultÚdynamismr$   )r%   r&   r'   r(   r)   rQ   rP   ÚdataclassesÚfieldr   r1   r-   r$   r.   r/   rý   rý     s.   ‡ ñð 
ƒHà&1×&7Ò&7¸UÈDÑ&Q€Hˆh˜‰n˜tÑ#ÖQr.   rý   Ú
constraintÚget_sourcesr   Ú	shape_envr   Úsource_pairs)r   r   Úderived_equalities)r   r   Úphantom_symbolsr   Úrelaxed_sourcesc                 óØ  ^• U" U R                   U R                  5      nU(       d  gUtmn	UR                  U4S jU	 5       5        [        U [        5      (       ai  U R
                  U;   a4  X0R
                     u  p«U" X«5      n	UR                  U4S jU	 5       5        gU R                   U R                  4X0R
                  '   g[        U [        5      (       Gaj  [        U R                  [        5      (       d5  U" U R                  R                   U R                  R                  5      S   nOöU R                  R
                  U;   a  X`R                  R
                     nOÃUR                  U R                  R                  [        R                  R                  R                  U R                  R
                  5      [        R                  R                   R"                  R$                  R&                  U R                  R(                  S9nXÆU R                  R
                  '   U R*                  nUR-                  TXÍ45        g[        U [.        5      (       a  UR1                  T5        gg)z˜
Updates `source_pairs`, `derived_equalities`, and `phantom_symbols` (which become
fields of `EqualityConstraint`) based on a given input `constraint`.
Nc              3   ó,   >#   • U  H	  nTU4v •  M     g 7fr8   r$   ©r¼   Úother_sourceÚsources     €r/   r½   Ú&_process_equalities.<locals>.<genexpr>*  s   øé € ÐQÂ=°<˜ Õ.Â=ùó   ƒc              3   ó,   >#   • U  H	  nTU4v •  M     g 7fr8   r$   r  s     €r/   r½   r  /  s   øé € ð  Ú;H¨<�˜Õ&º=ùr  r   )rò   r  Údynamic_dimÚconstraint_dim)rÂ   rÃ   ÚextendÚ
isinstancerÅ   rH   rô   r¤   rñ   Úcreate_symbolrò   ÚtorchÚ_dynamor  ÚConstantSourceÚfxÚexperimentalÚsymbolic_shapesÚ
DimDynamicr,   rÆ   r‡   rI   rø   Úadd)r  r  r  r¹   r  r  r  r	  ÚsourcesÚother_sourcesÚshared_t_idÚ
shared_dimr¤   r‡   r  s                 @r/   Ú_process_equalitiesr#    sÖ  ø€ ñ ˜*Ÿ/™/¨:¯>©>Ó:€GÞØà$Ð€Fˆ]ð ×ÑÔQÁ=ÓQÔQÜ�*œk×*Ñ*Ø�?‰?˜eÓ#Ø&+¯O©OÑ&<Ñ#ˆKÙ'¨Ó@ˆMØ×Ñô  Ù;Hó õ ð '1§o¡o°z·~±~Ð%FˆE—/‘/Ò"Ü	�JÔ 2×	3Ò	3ä˜*Ÿ/™/¬<×8Ñ8á˜zŸ™×3Ñ3°Z·_±_×5HÑ5HÓIÈ!ÑL‰Dð �‰×#Ñ# Ó6Ø&§¡×';Ñ';Ñ<‘ð !×.Ñ.Ø"Ÿ™×+Ñ+Ü Ÿ=™=×/Ñ/×>Ñ>¸z¿¹×?SÑ?SÓTÜ %§¡× 5Ñ 5× EÑ E× PÑ P× XÑ XØ#-§?¡?×#CÑ#Cð	 /ð �ð 9= 
§¡× 4Ñ 4Ñ5à�]‰]ˆð 	×!Ñ! 6¨4Ð"4Õ5Ü	�JÔ 2×	3Ñ	3Ø×Ñ˜FÕ#ð 
4r.   ©Ú	tree_nameÚfuncÚtreeÚdynamic_shapesr%  c          	      ó€  ^ ^^^	^
^^• S mU
U U4S jm
 [        T
U/UQ7ST06$ ! [         a�  nSUR                  S   ;   av  U(       d  [        S5      SeT(       d  [        S5      SeS	 m	U4S
 jmS[        S[        S[
        SS4UU	UU4S jjm[        UTS9nU H  n[        UT5      nT" XWS5        M     e SnAff = f)aî  
Customized tree_map for mapping pytrees to dynamic_shapes.

For built-in types (e.g., standard collections) this behaves exactly like tree_map.

OTOH for a user-defined class C registered with pytree, we cannot assume that a C
containing tensors can be mapped to a C containing dynamic shapes (i.e., C may not
be a polymorphic container). In that case we use the flattened form of C instead.
Thus a C(**tensors) that flattens to (**tensors) will map to (**dynamic_shapes).

Args:
    func: function to apply to each (int, float, str, bool, None, torch.Tensor)
    tree: input pytree
    dynamic_shapes: zero or more (typically one) dynamic_shapes to match

Returns:
    output pytree mapping func to each (int, float, str, bool, None, torch.Tensor)
c                 ó&   • [        U 5      [        ;  $ r8   )r
   r   )Úts    r/   Úis_leafÚ$_tree_map_with_path.<locals>.is_leafh  s   € ô
 ˜aÓ ¬Ñ5Ð5r.   c                 ó’   >• [        U5      nU[        ;   a)  [        T[        U   R                  U5      S   /UQ7ST06$ T" X/UQ76 $ )Nr   r,  )r
   r   r   Ú
flatten_fn)Úpathr+  r(  ÚtypÚfr&  r,  s       €€€r/   r2  Ú_tree_map_with_path.<locals>.fo  se   ø€ Ü˜QÓˆà”/Ó!ô &ØÜ Ñ$×/Ñ/°Ó2°1Ñ5ðð  òð  ñ	ð ñ ˜Ð1 .Ò1Ð1r.   r,  Úmismatchr   z2Cannot be a mismatch if there is no dynamic_shapesNz7Must provide a tree_name when there might be a mismatchc                 ó¨   • U [         L a  [        X   5      $ U [        [        4;   a  Ub  [	        SU  SU 35      e[        U5      $ [	        SU  35      e)Nz%expected context to be None for type ú, got zDid not expect type )Údictr   Úlistr¿   rB   r   )Útype_ÚcontextÚis      r/   Ú_keyÚ!_tree_map_with_path.<locals>._key�  sf   € àœD’=Ü% g¡jÓ1Ð1ØœT¤5˜MÓ)ØÑ*Ü,ØCÀEÀ7È&ÐQXÐPYÐZóð ô ' q›>Ð)Ü$Ð';¸E¸7Ð%CÓDÐDr.   c                 óD   >• SSK JnJn  U" UR                  ST SU  3SS9e)Nr   ©Ú	UserErrorÚUserErrorTypez,Detected mismatch between the structure of `z` and `dynamic_shapes`: Údynamic_shapes_validation©Ú	case_name)Útorch._dynamo.excr@  rA  ÚINVALID_INPUT)Úmsgr@  rA  r%  s      €r/   Úraise_mismatch_errorÚ1_tree_map_with_path.<locals>.raise_mismatch_error™  s2   ø€ ßFáØ!×/Ñ/ØBÀ9À+ÐMeÐfiÐejÐkØ9ñð r.   ÚtreespecÚother_treespecr0  rO   c                 ó  >• [        U5      nU R                  5       (       a  g UR                  5       (       a  T" ST U SU R                   SU S35        U R                  UR                  :w  a*  T" ST U SU R                   SU SUR                   3	5        U R                  UR                  :w  a+  T" ST U SU R                   SU SUR                   S3
5        U R                  [        L a¢  [        U R                  5      [        UR                  5      :w  a*  T" ST U SU R                   SU SUR                   3	5        [	        [        UR                  UR                  5       5      5      nU R                   Vs/ s H  oTU   PM	     nnOUR                  5       n[        [        U R                  5       U5      5       H2  u  nu  p‰T
" UU	UT" U R                  U R                  U5      4-   5        M4     g s  snf )	NÚ`z` is a z, but `dynamic_shapesz` is notz` has z elements, but `dynamic_shapesz	 elementsz` has keys )
r   r,  r3   Únum_childrenr7  Úsetr:  ÚzipÚchildrenÚ	enumerate)rJ  rK  r0  Úrendered_pathÚ_remapÚkÚother_childrenr;  ÚchildÚother_childÚ_comparer<  rH  r%  s             €€€€r/   rY  Ú%_tree_map_with_path.<locals>._compare¢  s#  ø€ ô
 !' t£�Ø×#Ñ#×%Ñ%ØØ!×)Ñ)×+Ñ+Ù(Ø˜I˜; } o°W¸X¿]¹]¸Oð L.Ø.;¨_¸HðFôð —=‘= N×$7Ñ$7Ó7Ù(Ø˜I˜; } o°W¸X¿]¹]¸Oð L.Ø.;¨_¸GÀN×DWÑDWÐCXðZôð ×(Ñ(¨N×,GÑ,GÓGÙ(Ø˜I˜; } o°V¸H×<QÑ<QÐ;Rð S.Ø.;¨_¸FÀ>×C^ÑC^ÐB_Ð_hðjôð —=‘=¤DÒ(ä˜8×+Ñ+Ó,´°N×4JÑ4JÓ0KÓKÙ,Ø 	˜{¨=¨/¸ÀX×EUÑEUÐDVð W2Ø2?°ÀÈN×LbÑLbÐKcðeôô "Ü˜N×2Ñ2°N×4KÑ4KÓ4MÓNó�Fð :B×9IÒ9IÓ%JÒ9I°A¨Q¤iÑ9I�NÐ%J�Nà%3×%<Ñ%<Ó%>�NÜ/8Ü˜×)Ñ)Ó+¨^Ó<ö0Ñ+�AÑ+˜ñ ØØ#Ø¡ X§]¡]°H×4DÑ4DÀaÓ HÐJÑJöò0ùò &Ks   ÆG>©r,  r$   )r   Ú
ValueErrorÚargsrB   r   r   r   )r&  r'  r%  r(  ÚerJ  Ú
other_treerK  rY  r<  r2  r,  rH  s   ` `     @@@@@r/   Ú_tree_map_with_pathr`  O  sæ   þ€ ò26÷2ðUÜ! ! TÐL¨NÒLÀGÑLÐLøÜó SØ˜Ÿ™ ™Ó"ö "Ü$ØHóàðö Ü$ØMóàðò
Eõð+Ü"ð+Ü4<ð+ÜDKð+à÷+ò +ôZ & d°GÑ<ˆHÛ,�
Ü!/°
¸GÓ!D�Ù˜°2Ö6ñ -ð 	ûðgSús   ”$ ¤
B=®B
B8Â8B=c                 óP  • [        U [        5      (       a  U R                  5       n [        U [        R                  R
                  5      (       a   [        R                  " U R                  5      O[        R                  " U 5      nUb  UO0 nUR                  " U0 UD6R                  $ r8   )r  r   Úmoduler  ÚnnÚModuleÚinspectÚ	signatureÚforwardÚbindÚ	arguments)r2  r]  Úkwargsrf  s       r/   Ú_combine_argsrk  Ö  s‚   € ô �!”_×%Ñ%Ø�H‰H‹Jˆô �aœŸ™Ÿ™×)Ñ)ô 	×Ò˜!Ÿ)™)Ô$ä×Ò˜qÓ!ð ð
 Ñ)‰V¨r€FØ�>Š>˜4Ð* 6Ñ*×4Ñ4Ð4r.   c                   ó:   • \ rS rSrSrS rS rS rS rS
S jr	S	r
g)ÚShapesCollectioniå  a¾  
Builder for dynamic_shapes.
Used to assign dynamic shape specifications to tensors that appear in inputs.

This is useful particularly when :func:`args` is a nested input structure, and it's
easier to index the input tensors, than to replicate the structure of :func:`args` in
the :func:`dynamic_shapes` specification.

Example::

    args = {"x": tensor_x, "others": [tensor_y, tensor_z]}

    dim = torch.export.Dim(...)
    dynamic_shapes = torch.export.ShapesCollection()
    dynamic_shapes[tensor_x] = (dim, dim + 1, 8)
    dynamic_shapes[tensor_y] = {0: dim * 2}
    # This is equivalent to the following (now auto-generated):
    # dynamic_shapes = {"x": (dim, dim + 1, 8), "others": [{0: dim * 2}, None]}

    torch.export(..., args, dynamic_shapes=dynamic_shapes)

To specify dynamism for integers, we need to first wrap the integers using
_IntWrapper so that we have a "unique identification tag" for each integer.

Example::

    args = {"x": tensor_x, "others": [int_x, int_y]}
    # Wrap all ints with _IntWrapper
    mapped_args = pytree.tree_map_only(int, lambda a: _IntWrapper(a), args)

    dynamic_shapes = torch.export.ShapesCollection()
    dynamic_shapes[tensor_x] = (dim, dim + 1, 8)
    dynamic_shapes[mapped_args["others"][0]] = Dim.DYNAMIC

    # This is equivalent to the following (now auto-generated):
    # dynamic_shapes = {"x": (dim, dim + 1, 8), "others": [Dim.DYNAMIC, None]}

    torch.export(..., args, dynamic_shapes=dynamic_shapes)
c                 ó   • 0 U l         g r8   ©Ú_shapesr•   s    r/   r^   ÚShapesCollection.__init__  s	   € Øˆ�r.   c                 ó*  • [        U[        R                  [        45      (       d  [	        S[        U5       35      e[        U5      nX0R                  ;   a&  U R                  U   nX$:w  a  [	        SU SU 35      eg X R                  [        U5      '   g )Nz:Cannot assign shape to non-tensor or non-_IntWrapper type z0Shapes assigned to input do not match: expected r6  )r  r  ÚTensorrý   rB   r3   Úidrp  )rC   r+  ÚshaperÂ   Ú_shapes        r/   Ú__setitem__ÚShapesCollection.__setitem__  s’   € Ü˜!œeŸl™l¬KÐ8×9Ñ9Ü ØLÌTÐRSËWÈIÐVóð ô �!‹uˆØ—<‘<ÓØ—\‘\ $Ñ'ˆFØ‹Ü$ØFÀvÀhÈfÐUZÐT[Ð\óð ð ð
 #(�L‰Lœ˜A›Òr.   c                 ór   • [        U5      nX R                  ;  a  0 U R                  U'   U R                  U   $ r8   )rt  rp  )rC   r+  rÂ   s      r/   Ú__getitem__ÚShapesCollection.__getitem__#  s2   € Ü�!‹uˆØ—|‘|Ó#Ø!#ˆD�L‰L˜ÑØ�|‰|˜DÑ!Ð!r.   c                 ó,   • [        U R                  5      $ r8   )Úlenrp  r•   s    r/   Ú__len__ÚShapesCollection.__len__)  s   € Ü�4—<‘<Ó Ð r.   Nc                 ó¸   ^ ^• [        5       mU U4S jn[        XU5      n[        XE5      n[        U4S jT R                   5       5      (       a  [        S5      eU$ )ze
Generates the :func:`dynamic_shapes` pytree structure according to :func:`args` and :func:`kwargs`.
c                 ó|   >• [        U5      nUTR                  ;   a   TR                  U5        TR                  U   $ g r8   )rt  rp  r  )r0  r+  rÂ   rC   Út_idss      €€r/   Ú
find_shapeÚ3ShapesCollection.dynamic_shapes.<locals>.find_shape3  s5   ø€ Ü�a“5ˆDØ�t—|‘|Ó#Ø—	‘	˜$”Ø—|‘| DÑ)Ð)àr.   c              3   ó,   >#   • U  H	  oT;  v •  M     g 7fr8   r$   )r¼   rÂ   r‚  s     €r/   r½   Ú2ShapesCollection.dynamic_shapes.<locals>.<genexpr>=  s   øé € Ð:ª\ T˜5Ö ª\ùr  zÊSome tensors that were assigned shapes were not found in args. Maybe such tensors were copied when passing them as args? Maybe such tensors are contained in classes that were not registered with pytree?)rO  rk  r`  Úanyrp  r\  )rC   Úmr]  rj  rƒ  Úcombined_argsr(  r‚  s   `      @r/   r(  ÚShapesCollection.dynamic_shapes,  sY   ù€ ô
 “ˆö	ô & a¨vÓ6ˆÜ,¨ZÓGˆÜÔ:¨T¯\ª\Ó:×:Ñ:Üðdóð ð
 Ðr.   ro  r8   )r%   r&   r'   r(   r)   r^   rw  rz  r~  r(  r-   r$   r.   r/   rm  rm  å  s!   † ñ&òPò(ò$"ò!÷r.   rm  c                   ó8   • \ rS rSrSrS rS	S jrS	S jrS rSr	g)
r    iF  a	  
Infers dynamic_shapes based on additional inputs.

This is useful particularly for deployment engineers who, on the one hand, may
have access to ample testing or profiling data that can provide a fair sense of
representative inputs for a model, but on the other hand, may not know enough
about the model to guess which input shapes should be dynamic.

Input shapes that are different than the original are considered dynamic; conversely,
those that are the same as the original are considered static. Moreover, we verify
that the additional inputs are valid for the exported program. This guarantees that
tracing with them instead of the original would have generated the same graph.

Example::

    args0, kwargs0 = ...  # example inputs for export

    # other representative inputs that the exported program will run on
    dynamic_shapes = torch.export.AdditionalInputs()
    dynamic_shapes.add(args1, kwargs1)
    ...
    dynamic_shapes.add(argsN, kwargsN)

    torch.export(..., args0, kwargs0, dynamic_shapes=dynamic_shapes)
c                 ó   • / U l         g r8   ©Ú	_examplesr•   s    r/   r^   ÚAdditionalInputs.__init__a  s	   € Øˆ�r.   Nc                 óÆ   • [        U5      [        La  [        SU S35      eUb!  [        U5      [        La  [        SU S35      eU R                  R                  X45        g)z3
Additional input :func:`args` and :func:`kwargs`.
zRepresentative args z must be a tupleNzRepresentative kwargs z must be None or a dict)r3   r¿   rB   r7  rŽ  rI   )rC   r]  rj  s      r/   r  ÚAdditionalInputs.addd  sg   € ô
 �‹:œUÒ"Ü Ð#7¸°vÐ=MÐ!NÓOÐOØÑ¤$ v£,´dÒ":Ü Ø(¨¨Ð0GÐHóð ð 	�‰×Ñ˜t˜nÕ-r.   c                 ó¬   • X#4/U R                   Q VVs/ s H  u  p#[        S [        XU5      5      PM     snntpES n[        UU/UQ7SS 06$ s  snnf )z¨
Infers a :func:`dynamic_shapes` pytree structure by merging shapes of the
original input :func:`args` and :func:`kwargs` and of each additional input
args and kwargs.
c                 ón   • [        U[        R                  5      (       a  [        UR                  5      $ U$ r8   )r  r  rs  r¿   ru  )r0  r+  s     r/   rf   Ú1AdditionalInputs.dynamic_shapes.<locals>.<lambda>z  s%   € ´*¸QÄÇÁ×2MÑ2M¤ a§g¡g£Ð TÐSTÐ Tr.   c                 ód  ^ • [        U 4S jU 5       5      (       d  [        ST 4U-    S35      e[        T [        5      (       a@  [        T [        5      (       d+  [        U 4S jU 5       5      (       a  g [
        R                  $ [        U 4S jU 5       5      (       d  [        ST 4U-    S35      eg )Nc              3   óP   >#   • U  H  n[        T5      [        U5      L v •  M     g 7fr8   )r3   )r¼   re   Úvs     €r/   r½   ÚJAdditionalInputs.dynamic_shapes.<locals>._mark_dynamism.<locals>.<genexpr>�  s   øé € ÐDº8°%”t˜A“w¤$ u£+Õ-º8ùs   ƒ#&z^The following inputs were found to have differing types, so they cannot be marked as dynamic: Ú.c              3   ó,   >#   • U  H	  oT:H  v •  M     g 7fr8   r$   ©r¼   Úother_vr—  s     €r/   r½   r˜  ˆ  s   øé € Ð<²8¨ !–|²8ùr  c              3   ó,   >#   • U  H	  oT:H  v •  M     g 7fr8   r$   r›  s     €r/   r½   r˜  �  s   øé € Ð@²x¨G až<²xùr  z`The following inputs were found to have differing values, but they cannot be marked as dynamic: )Úallr\  r  rQ   rR   r   r,   )r—  Úother_vss   ` r/   Ú_mark_dynamismÚ7AdditionalInputs.dynamic_shapes.<locals>._mark_dynamism€  s±   ø€ ÜÔD¹8ÓD×DÑDÜ ð<Ø=>¸DÀ8¹OÐ;LÈAðOóð ô
 ˜!œS×!Ñ!¬*°Q¼×*=Ñ*=ÜÔ<±8Ó<×<Ñ<ØäŸ;™;Ð&äÔ@±xÓ@×@Ñ@Ü$ðAØBCÀÈÁÐ@QÐQRðTóð ð r.   r,  c                 ó$   • [        U 5      [        L $ r8   )r3   rQ   )r;  s    r/   rf   r”  ˜  s   € œd 1›g¬™nr.   )rŽ  r`  rk  r   )rC   rˆ  r]  rj  r(  Úother_dynamic_shapesr   s          r/   r(  ÚAdditionalInputs.dynamic_shapesq  s   € ð #' Ð A°$·.±.Ñ Aô1
ò
 !B‘�ô	  ÙTÜ˜a vÓ.öñ !Bò1
Ð-ˆò	ô( ØØð
ð "ò
ñ -ñ	
ð 	
ùó91
s   ”#Ac                 ó´   • UR                  5       nU R                   H8  u  p4[        R                  R                  R                  X#U=(       d    0 5        M:     g)zG
Verifies that an exported program is valid for each additional input.
N)rb  rŽ  r  ÚexportÚ_unliftÚ#_check_input_constraints_for_module)rC   ÚepÚepmr]  rj  s        r/   ÚverifyÚAdditionalInputs.verify›  s@   € ð
 �i‰i‹kˆØ ŸNœN‰LˆDÜ�L‰L× Ñ ×DÑDØ˜6Ÿ< Röò +r.   r�  r8   )
r%   r&   r'   r(   r)   r^   r  r(  r«  r-   r$   r.   r/   r    r    F  s   † ñò4ô.ô(
õT	r.   r    c                  ó2   • Sn [         R                  U 5        g )NzTUsing None as a dynamic shape dimension is deprecated. Please use Dim.STATIC instead)ÚlogÚwarning)rG  s    r/   Ú%_warn_on_None_dynamic_shape_dimensionr°  §  s   € ð	(ð ô
 ‡K�K�Õr.   r‰  c                 óÞ  ^^^^	^
• SSK JmJm  Ub  [        U5      S:X  a  g[	        U[
        [        45      (       a  [        U5      " U R                  5       5      n 0 mUUU4S jm	UUU	4S jm
[	        U[        [
        [        45      (       d  [        S[        U5       35      e[	        U[        5      (       a¢  [        UR                  5       5      n[        U R                  5       5      n[        U5      [        U5      :w  aX  SU SU S	3n[        U 5      S
:X  a)  US   U;  a   [	        XS      [        5      (       a  US-  nOUS-  nT" TR                  USS9eUUU
4S jn[        XPUSS9  g)zz
Checks the dynamic_shapes specification for correctness,
using combined args + kwargs as reference for inputs structure.
r   r?  Nc           
      ó¸  >• U R                   T;   a¤  TU R                      u  pU R                  U:w  d  U R                  U:w  ar  [        R	                  U R                   X5      n[        R	                  U R                   U R                  U R                  5      nT" TR
                  SU SU SU  S35      eg U R                  U R                  4TU R                   '   g )NzFound different definitions z and z! for the same symbolic dimension Ú!)r%   r4   r5   r   r’   rF  )rÃ   rŽ   r�   Úthis_Úthat_r@  rA  Úboundss        €€€r/   Úcheck_same_boundsÚ0_check_dynamic_shapes.<locals>.check_same_boundsÁ  s½   ø€ Ø�<‰<˜6Ó!Ø §¡Ñ-‰JˆDØ�w‰w˜$‹ #§'¡'¨T£/ÜŸ™ c§l¡l°DÓ?�ÜŸ™ c§l¡l°C·G±G¸S¿W¹WÓE�ÙØ!×/Ñ/Ø2°5°'¸¸u¸gð F7Ø7:°e¸1ð>óð ð #2ð %(§G¡G¨S¯W©WÐ#5ˆF�3—<‘<Ò r.   c                 ó¼  >• [        U[        5      (       aŒ  UR                  5        Hw  u  p4[        U[        5      (       a
  T" U5        M$  Uc  [	        5         M3  [        U[
        [        45      (       a  MP  T" TR                  SU SU S[        U 5       SU< S3	SS9e   g [        U[        [        45      (       aú  [        U5      [        UR                  5      :w  aQ  T" TR                  SU S[        U 5       S	UR                   S
[        UR                  5       S[        U5       S3SS9e[        U5       Hw  u  p4[        U[        5      (       a
  T" U5        M$  Uc  [	        5         M3  [        U[
        [        45      (       a  MP  T" TR                  SU SU S[        U 5       SU< S3	SS9e   g Ub"  T" TR                  SU S[        U 5       S3SS9eg )Nz%Unexpected dimension mapped to index z in input tensor shape ú specified at `dynamic_shapeszP` (expected None, an int, a Dim, Dim.AUTO, Dim.STATIC, or Dim.DYNAMIC,  but got z	 instead)rB  rC  zExpected dynamic shape spec z5` to have the same length as the actual tensor shape z (expected z
, but got zUnexpected dimension #zO` (expected None, an int, a Dim, Dim.AUTO, Dim.STATIC, or Dim.DYNAMIC, but got zUnexpected input tensor shape z¤` (expected either a list/tuple of dimensions, or a dict mapping indices to dimensions, where each dimension is an int, a Dim, Dim.AUTO, Dim.STATIC, or Dim.DYNAMIC))r  r7  Úitemsr   r°  rQ   r1   rF  r   r¿   r8  r}  ru  rR  )r0  Útensorru  r;  rÃ   r@  rA  r·  s        €€€r/   Úcheck_symbolsÚ,_check_dynamic_shapes.<locals>.check_symbolsÏ  s  ø€ Ü�eœT×"Ñ"ØŸ+™+ž-‘�Ü˜c¤3×'Ñ'Ù% cÖ*Ø‘[Ü9Ö;Ü$ S¬3´¨/×:Ó:Ù#Ø%×3Ñ3Ø?À¸sÐBYÐZ_ÐY`ð a7Ü7=¸d³|°nð E$à$'¡7¨)ð5ð #>ñð ò (ô ˜¤¤t˜}×-Ñ-Ü�5‹zœS §¡Ó.Ó.ÙØ!×/Ñ/Ø2°5°'Ð9VÔW]Ð^bÓWcÐVdð eJØJPÏ,É,Èð X!Ü!$ V§\¡\Ó!2Ð 3°:¼cÀ%»j¸\ÈðTð :ñð ô $ EÖ*‘�Ü˜c¤3×'Ñ'Ù% cÖ*Ø‘[Ü9Ö;Ü$ S¬3´¨/×:Ó:Ù#Ø%×3Ñ3Ø0°°Ð3JÈ5È'ð R7Ü7=¸d³|°nð E#à#&¡'¨ð4ð #>ñð ò +ð ÑÙØ×+Ñ+Ø0°°Ð7TÔU[Ð\`ÓUaÐTbð c`ð að 6ñð ð r.   z8expected dynamic_shapes to be dict, tuple, or list, got zWWhen `dynamic_shapes` is specified as a dict, its top-level keys must be the arg names z  of `inputs`, but here they are z. r   zSince here `inputs` is a list/tuple enclosing a single dict, maybe you just forgot to enclose `dynamic_shapes` in a list/tuple?zwAlternatively, you could also ignore arg names entirely and specify `dynamic_shapes` as a list/tuple matching `inputs`.rB  rC  c                 óœ  >• [        U[        R                  5      (       a
  T" XU5        g [        U[        5      (       aW  [        U[        5      (       a  [        S5      eUb3  [        U[        [        45      (       d  [        S[        U5       35      eg g Ub3  [        U 5      nT" TR                  SU SU S[        U5       SU S3	SS	9eg )
NzdUnable to specify input integers as dynamic through named Dims. Please use Dim.AUTO/DYNAMIC instead.zIexpected dynamic_shape to be None, int, or _DimHint for _IntWrapper, got zCannot associate shape rº  z` to non-tensor type z at `inputsz` (expected None)rB  rC  )r  r  rs  rý   Ú_Dimr\  rQ   r1   rB   r3   r   rF  )r0  r+  Údynamic_shaperS  r@  rA  r½  s       €€€r/   Úcheck_shapeÚ*_check_dynamic_shapes.<locals>.check_shape  sî   ø€ Ü�aœŸ™×&Ñ&Ù˜$ =Õ1Ü˜œ;×'Ñ'Ü˜-¬×.Ñ.Ü ðAóð ð Ñ(´Ø¤¤X˜÷2ñ 2ô %Ø_Ô`dÐerÓ`sÐ_tÐuóð ð2Ð(ð Ñ(Ü & t£�ÙØ!×/Ñ/Ø-¨m¨_Ð<YÐZgÐYhð i*Ü*.¨q«'¨°+¸m¸_ÐL]ð_à9ñ	ð ð )r.   Úinputsr$  )rE  r@  rA  r}  r  r¿   r8  r3   Úvaluesr7  rB   ÚkeysÚsortedrF  r`  )r‰  r(  Úgot_keysÚexpected_arg_namesrG  rÂ  r@  rA  r¶  r·  r½  s         @@@@@r/   Ú_check_dynamic_shapesrÊ  °  sv  ü€ ÷ ;àÑ¤ ^Ó!4¸Ó!9ØÜ�.¤5¬$ -×0Ñ0Ü˜^Ô,¨]×-AÑ-AÓ-CÓDˆà)+€F÷6÷.ô` �n¤t¬U´DÐ&9×:Ñ:ÜØFÄtÈNÓG[ÐF\Ð]ó
ð 	
ô �.¤$×'Ñ'Ü˜×+Ñ+Ó-Ó.ˆÜ! -×"4Ñ"4Ó"6Ó7ÐÜ�(ÓœvÐ&8Ó9Ó9ð)Ø);Ð(<ð =!Ø!) 
¨"ð.ð ô �MÓ" aÓ'Ø& qÑ)°Ó9Ü˜}ÀÑ-BÑCÄT×JÑJàðYñ‘ð
 ðVñ�ñ Ø×+Ñ+¨SÐ<Wñð ÷ô2 ˜°NÈhÓWr.   c                 óü  ^^^^	^
^^^^• SSK JmJm  Ub  [        U5      S:X  a  / $ [	        U[
        [        45      (       a  [        U5      " U R                  5       5      n [        [        5      m0 m/ m
/ m	UUU
UU4S jmS	U	UU4S jjmU4S jmU4S jn[        X USS9  T
 H.  nUR                  R                  nUT;   d  M!  TU   S   Ul        M0     TR                  5        H  nT	R                  U5        M     T	$ )
zL
Reads the dynamic_shapes specification and produces a list of constraints.
r   r?  c                 óV  >^ ^^^
^• SS K m
SSKJn  SSKJm  SSKJn  UUU UU
UU4S jn[        T [        5      (       Ga)  T R                  nUR                  T;   a3  TUR                     S   n[        UR                  UR                  5      nOgUR                  T;  aH  [        UR                  U" U" UR                  UR                   S9SS9U" 5       S	9nUTUR                  '   OTUR                     n[#        [%        T5      TT R                  U" U" T R                  T R                   S9SS9UT R&                  5      n	[        U[        5      (       a  TR)                  U	5        U	$ [        T [*        5      (       aA  [-        [%        T5      TT R                  U" U" T R.                  T R.                  S9SS95      n	U	$ [        T [0        5      (       d  [3        S
[5        T 5       35      e[-        [%        T5      TT R                  U" U" T R                  T R                   S9SS95      n	U	$ )Nr   rÈ   )Ú	try_solverÉ   c                  ó6  >• TR                  TR                  R                  SS9n TR                  U 5      nT	" TR	                  UTR
                  T   5      U 5      nUb  [        US   5      $ T" TR                  ST STR
                  T    SU SU  S3	5      e)	NT)Úintegerr   zExpected shape[z] = z# of input Tensor to be of the form z, where z is an integer)r   r¤   r%   r‡   ÚEqru  rQ   ÚCONSTRAINT_VIOLATION)
ÚsymbolÚexprÚsolutionr@  rA  rÃ   r;  r…   r¼  rÍ  s
      €€€€€€€r/   Ú
root_valueÚB_process_dynamic_shapes.<locals>.to_constraint.<locals>.root_valueX  s¦   ø€ ð —\‘\ #§(¡(×"3Ñ"3¸T�\ÐBˆFØ—6‘6˜&“>ˆDÙ  §¡¨$°·±¸Q±Ó!@À&ÓIˆHØÑ#Ü˜8 A™;Ó'Ð'áØ!×6Ñ6Ø% a S¨¨V¯\©\¸!©_Ð,=ð >#Ø#' &¨°°¸ðHóð r.   rË   FrÎ   )rH   rÆ   rò   zexpected dim to be Dim, got )r…   rÑ   r   Útorch.utils._sympy.solverÍ  rÒ   rÊ   r  r‹   r¤   r%   rÁ   rÂ   rÃ   rñ   r4   r5   rô   rt  r‡   rI   r˜   rÅ   r™   r   rB   r3   )rÃ   r¼  r;  r   rÊ   rÕ  Údim_rootÚroot_constraintr¤   r  r…   rÍ  r@  rA  Ú%derived_constraints_with_phantom_rootÚphantom_rootsÚsymbolss   ```       @@€€€€€r/   Úto_constraintÚ._process_dynamic_shapes.<locals>.to_constraintQ  sû  ý€ ÛåPÝ6Ý?÷	ó 	ô �cœ;×'Ò'ð —x‘xˆHØ× Ñ  GÓ+à")¨(×*;Ñ*;Ñ"<¸QÑ"?�Ü(Ø#×(Ñ(Ø#×'Ñ'ó‘ð ×"Ñ"¨-Ó7ä#Ø!×*Ñ*Ù%;Ù&¨X¯\©\ÀÇÁÑNØ"'ñ&ñ #›ñ�ð 48�˜h×/Ñ/Ò0à$ X×%6Ñ%6Ñ7�Ü+Ü�6“
ØØ—‘Ù&Ù"¨¯©¸¿¹Ñ@Ø#ñð Ø—‘ó
ˆJô ˜$¤×-Ñ-ð 6×<Ñ<¸ZÔHð. Ðô- ˜œZ×(Ñ(Ü$Ü�6“
ØØ—‘Ù&Ù"¨¯©¸#¿)¹)ÑDØ#ñó	ˆJð* Ðô ˜c¤3×'Ñ'Ü$Ð'CÄDÈÃIÀ;Ð%OÓPÐPÜ$Ü�6“
ØØ—‘Ù&Ù"¨¯©¸¿¹Ñ@Ø#ñó	ˆJð Ðr.   c                 óú  >• S n[        U[        [        45      (       aF  [        U[        5      (       a	  U" XU5      nT" X U5      nTUR                     R	                  U5        g [        U[
        5      (       aÞ  UR                  [        R                  :X  a   [        R                  R                  X5        O{UR                  [        R                  :X  a   [        R                  R                  X5        O=UR                  [        R                  :X  a  [        R                  R                  X5        TR	                  [!        [#        U 5      U5      5        g Uc   [        R                  R                  X5        g g )Nc                 ó   • [        U5      $ r8   )r˜   )r¼  r;  r™   s      r/   Ú_create_static_dimÚN_process_dynamic_shapes.<locals>._parse_tensor_dim.<locals>._create_static_dim¨  s   € Ü˜eÓ$Ð$r.   )r  rQ   r   r%   rI   r1   r3   r"   r*   r  r  Úmaybe_mark_dynamicr+   Úmark_staticr,   Úmark_dynamicrø   rt  )r¼  ÚidxrÃ   rá  r  ÚconstraintsrÜ  rÝ  s        €€€r/   Ú_parse_tensor_dimÚ2_process_dynamic_shapes.<locals>._parse_tensor_dim§  s  ø€ ò	%ô �cœC¤˜:×&Ñ&Ü˜#œs×#Ñ#Ù(¨°cÓ:�Ù& s°CÓ8ˆJØ�C—L‘LÑ!×(Ñ(¨Õ4Ü˜œX×&Ñ&Ø�x‰xœ<×,Ñ,Ó,Ü—‘×0Ñ0°Õ=Ø—‘œ\×0Ñ0Ó0Ü—‘×)Ñ)¨&Õ6Ø—‘œ\×1Ñ1Ó1Ü—‘×*Ñ*¨6Ô7Ø×ÑÔ1´"°V³*¸cÓBÕCØ‰[Ü�M‰M×%Ñ% fÕ2ð r.   c                 óØ  >• [        5       Ul        [        5       Ul        [        5       Ul        [        5       Ul        [        5       Ul        [        U[        5      (       a#  UR                  5        H  u  p4T" XU5        M     g [        U[        [        45      (       a  [        U5       H  u  p4T" XU5        M     g Uc*  [        UR                  5       5       H  nT" XS 5        M     g g r8   )rO  Ú_dynamo_weak_dynamic_indicesÚ_dynamo_dynamic_indicesÚ_dynamo_dynamic_rangeÚ_dynamo_static_indicesÚ_dynamo_unbacked_indicesr  r7  r»  r¿   r8  rR  ÚrangerÃ   )r0  r¼  ru  r;  rÃ   rè  s        €r/   Úupdate_symbolsÚ/_process_dynamic_shapes.<locals>.update_symbols»  sµ   ø€ ô /2«eˆÔ+Ü),«ˆÔ&Ü'*£uˆÔ$Ü(+«ˆÔ%Ü*-«%ˆÔ'ä�eœT×"Ñ"ØŸ+™+ž-‘�Ù! &¨SÖ1ò (ä˜¤¤t˜}×-Ñ-Ü# EÖ*‘�Ù! &¨SÖ1ò +à‰]Ü˜6Ÿ:™:›<Ö(�Ù! &¨TÖ2ò )ð r.   c                 ó�   >• [        U[        R                  5      (       a
  T" XU5        g [        U[        5      (       a  X!l        g g r8   )r  r  rs  rý   r   )r0  r+  rÁ  rñ  s      €r/   Úassoc_shapeÚ,_process_dynamic_shapes.<locals>.assoc_shapeÎ  s7   ø€ Ü�aœŸ™×&Ñ&Ù˜4 MÕ2Ü˜œ;×'Ñ'ð '�Jð (r.   rÄ  r$  )rO   N)rE  r@  rA  r}  r  r¿   r8  r3   rÅ  r   r`  r¤   rH   r  )r‰  r(  rô  Ú$derived_constraint_with_phantom_rootÚphantom_root_nameÚdynamic_dimsr@  rA  rè  rç  rÚ  rÛ  rÜ  rÝ  rñ  s         @@@@@@@@@r/   Ú_process_dynamic_shapesrù  :  sû   ÿø€ ÷ ;àÑ¤ ^Ó!4¸Ó!9àˆ	Ü�.¤5¬$ -×0Ñ0Ü˜^Ô,¨]×-AÑ-AÓ-CÓDˆô ,7´tÓ+<€Gà-/€MØFHÐ)à$&€K÷Tñ T÷l3ñ 3õ(3õ&	'ô ˜°NÈhÒWã0UÐ,Ø@×EÑE×JÑJÐØ Õ'ð 9@Ð@QÑ8RÐSTÑ8UÐ0Ö5ñ 1Vð  Ÿ™Ö(ˆØ×Ñ˜<Ö(ñ )ð Ðr.   c                 óz  • 0 n[        U S S9 H©  nUc  M  [        U[        5      (       a  M  [        U[        5      (       aI  X!UR                  '   [        U[
        5      (       a$  UR                  XR                  R                  '   M{  M}  [        U[        5      (       a  M”  [        S[        U5       35      e   U$ )Nc                 ó"   • [        U [        5      $ r8   )r  r   )rd   s    r/   rf   Ú'_get_dim_name_mapping.<locals>.<lambda>ñ  s   € ¼:ÀaÌÔ;Mr.   r[  z!expected dim to be _DimHint, got )
r   r  rQ   r   r%   r‹   r¤   r1   rB   r3   )r(  Úname_to_dimrÃ   s      r/   Ú_get_dim_name_mappingrþ  í  s£   € ð €KÜ˜Ñ1MÔNˆØ‰;áÜ�cœ3×ÑÙÜ˜œS×!Ñ!Ø(+˜Ÿ™Ñ%Ü˜#œ{×+Ñ+Ø14·±�ŸH™H×-Ñ-Ó.ñ ,ô ˜c¤8×,Ó,Ü$Ð'HÌÈcËÈÐ%TÓUÐUñ Oð Ðr.   rG  c           
      óÒ  ^^^^• SSK nSSKmSSKJnJn  SSKJn   U R                  S5      S   R                  5       n0 mUR                  S5       GH  nUR                  5       nUR                  S	U5      =n	(       aŠ  U	R                  S5      n
S
u  p¼UR                  SU5      =n(       a  [        UR                  S5      5      nUR                  SU5      =n(       a  [        UR                  S5      5      n[        X«US9TU
'   M·  UR                  S5      u  p¯TR                  U5      n[!        UTR"                  5      (       a  [        U5      TU
'   GM  UTU
'   GM     [%        U5      m['        5       nTR)                  5        Hú  u  nn[!        U[        [        [*        TR,                  45      (       d  [/        SU< S[1        U5       35      e[!        UTR,                  5      (       aW  U" U5      (       d  [/        SU S35      eUTU'   UR3                  [5        [7        [9        UR:                  5      5      5      5        [!        U[*        5      (       d  MÕ  UR3                  UR<                  R>                  5        Mü     T H!  nUT;  d  M  UU;  d  M  [/        SU< S35      e   0 mUUUU4S jn[A        UX5      $ ! [         a  nU" UR                  S5      UeSnAff = f)a]  
When exporting with :func:`dynamic_shapes`, export may fail with a ConstraintViolation error if the specification
doesn't match the constraints inferred from tracing the model. The error message may provide suggested fixes -
changes that can be made to :func:`dynamic_shapes` to export successfully.

Example ConstraintViolation error message::

    Suggested fixes:

        dim = Dim('dim', min=3, max=6)  # this just refines the dim's range
        dim = 4  # this specializes to a constant
        dy = dx + 1  # dy was specified as an independent dim, but is actually tied to dx with this relation

This is a helper function that takes the ConstraintViolation error message and the original :func:`dynamic_shapes` spec,
and returns a new :func:`dynamic_shapes` spec that incorporates the suggested fixes.

Example usage::

    try:
        ep = export(mod, args, dynamic_shapes=dynamic_shapes)
    except torch._dynamo.exc.UserError as exc:
        new_shapes = refine_dynamic_shapes_from_suggested_fixes(
            exc.msg, dynamic_shapes
        )
        ep = export(mod, args, dynamic_shapes=new_shapes)

r   Nr?  )Ú_is_supported_equivalencezSuggested fixes:r   z`Suggested fixes not found in error message given to refine_dynamic_shapes_from_suggested_fixes()Ú
z(.*) = Dim\('(.*)'.*\)rN   z!.* = Dim\('.*', min\=([0-9]+).*\)z.* = Dim\('.*'.*max\=([0-9]+)\)rV   z = zexpected shape_fixes[z2] to be int, Dim, _DerivedDim, or sympy.Expr, got zsympy.Expr z is not a supported equivalencezshape_fixes key z" not found in name_to_dim or rootsc                 ó®  >• Ub  [        U[        5      (       a  U$ UR                  T;   Ga!  TUR                     n[        UTR                  5      (       aõ  [	        U5      T	;   a  T	[	        U5         $ [        [        UR                  5      5      nUR                  T;   a  TUR                     nO9UR                  T
;  a  [        SUR                  < S35      eT
UR                     nTR                  R                  R                  X45      u  pgUnUS:w  a  [        U5      U-  nUS:w  a  U[        U5      -   nUT	[	        U5      '   U$ U$ [        U[        5      (       ar  UR                  R                  T;   aX  UR                  T	;   a  T	UR                     $ UR                  TUR                  R                     5      nUT	UR                  '   U$ U$ )Nzsymbol.name z not found in name_to_dimr   r   )r  rQ   r%   ÚExprr†   ÚnextÚiterÚfree_symbolsrH   rB   ÚpolysÚ	polytoolsÚdivr‹   r¤   r‡   )r0  rÃ   ÚdummyÚfixrÒ  r¤   ÚmodulusÚ	remainderÚ_dimÚderived_dim_cacherý  Úshape_fixesr…   s            €€€€r/   Úapply_fixesÚ?refine_dynamic_shapes_from_suggested_fixes.<locals>.apply_fixesa  sž  ø€ Ø‰;œ* S¬#×.Ñ.ØˆJØ�\‰\˜[Ô(Ø˜cŸl™lÑ+ˆCÜ˜#˜uŸz™z×*Ñ*Ü�s“8Ð0Ó0Ø,¬S°«XÑ6Ð6ä!¤$ s×'7Ñ'7Ó"8Ó9�Fà—{‘{ kÓ1Ø*¨6¯;©;Ñ7™à!Ÿ;™;¨kÓ9Ü"0Ø".¨v¯{©{©oÐ=VÐ Wó#ð ð  +¨6¯;©;Ñ7˜à).¯©×)>Ñ)>×)BÑ)BÀ3Ó)OÑ&�GØ�CØ !“|Ü! '›l¨SÑ0˜Ø  A“~Ø!¤C¨	£NÑ2˜à25Ð%¤c¨#£hÑ/Ø�Jà�
Ü˜œ[×)Ñ)¨c¯h©h×.?Ñ.?À;Ó.NØ�|‰|Ð0Ó0Ø(¨¯©Ñ6Ð6à—v‘v˜k¨#¯(©(×*;Ñ*;Ñ<Ó=�Ø26Ð! #§,¡,Ñ/Ø�Øˆ
r.   )!Úrer…   rE  r@  rA  rÑ   r   ÚsplitÚstripÚ	ExceptionrF  ÚmatchÚgrouprQ   r   r„   r  ÚNumberrþ  rO  r»  r‹   r  rB   r3   r  r†   r  r  r  r¤   r%   r`  )rG  r(  r  r@  rA  r   Úshape_fixes_msgÚexcr  r  rH   r\   r]   Ú	match_minÚ	match_maxrÓ  ÚrootsrU  Úcr  r  rý  r  r…   s                       @@@@r/   r   r     s£  û€ ó@ ãç:ÝOðØŸ)™)Ð$6Ó7¸Ñ:×@Ñ@ÓBˆð €KØ×$Ñ$ T×*ˆØ�i‰i‹kˆØ—H‘HÐ6¸Ó<Ð<ˆ5Õ<Ø—;‘;˜q“>ˆDØ#‰JˆDØŸH™HÐ%IÈ3ÓOÐOˆyÕOÜ˜9Ÿ?™?¨1Ó-Ó.�ØŸH™HÐ%GÈÓMÐMˆyÕMÜ˜9Ÿ?™?¨1Ó-Ó.�Ü # D¸Ñ =ˆK˜ÓàŸ™ 5Ó)‰JˆDØ—=‘= Ó&ˆDÜ˜$ §¡×-Ñ-ä$'¨£I�˜DÔ!ð %)�˜DÔ!ñ% +ô( (¨Ó7€Kô “e€EØ×!Ñ!Ö#‰ˆˆ1Ü˜!œc¤3¬°U·Z±ZÐ@×AÑAÜ Ø'¨¡uÐ,^Ô_cÐdeÓ_fÐ^gÐhóð ô �a˜Ÿ™×$Ñ$Ù,¨Q×/Ñ/Ü$ {°1°#Ð5TÐ%UÓVÐVØˆK˜‰NØ�I‰I”cœ$œt A§N¡NÓ3Ó4Ó5Ô6Ü�aœ×%Ó%Ø�I‰I�a—f‘f—o‘oÖ&ñ $ó ˆØ�KÕ A¨U¥NÜ Ø" 1¡%Ð'IÐJóð ñ ð 13Ð÷&ð &ôP ˜{¨NÓKÐKøô ó ÙØ×'Ñ'Ønó
ð ð	ûðús   œ"K Ë
K&ËK!Ë!K&)Ir  re  Úloggingr¯   Úcollectionsr   Úcollections.abcr   Úenumr   r   Útypingr   r   r	   r  Útorch.utils._pytreer
   r   r   r   r   r   r   r   r   r   r   r   Úexported_programr   r…   r   Útorch._guardsr   rÑ   r   r   Ú__all__Ú	getLoggerr%   r®  r"   Ú	dataclassr1   r   rÀ  r˜   r‹   r†   rQ   r¿   r   rÁ   rÅ   rñ   rô   rø   r   rý   r8  r7  rO  r#  r`  rk  rm  r    r°  rÊ  rù  rþ  r   r$   r.   r/   Ú<module>r+     s  ðã Û Û Û 
Ý #Ý $ß ß ,Ñ ,ã ÷÷ ÷ ó õ .ö Ýå$ßVò€ð ×Ò˜Ó!€ô
�4ô 
ð ×Ñ÷,.ð ,.ó ð,.÷^S@ñ S@ðl €ô�ô ô*J�#ô Jð\ $(¸4ò	@Øð	@Ø˜D‘jð	@Ø.1°D©jð	@à
ˆ3�ˆ8�_õ	@ð ×Ñ÷ð ó ðð ×ÑôD
Ð#ó D
ó ðD
ðN ×Ñ÷ð ó ðð" ×Ñô
Ð*ó 
ó ð
ð4 ×Ñô
Ð*ó 
ó ð
ð  Ð-Ñ-Ð0BÑB€
ð ×Ñ÷	Rð 	Ró ð	Rð8$Øð8$à˜3 ˜* d¨8¡nÐ4Ñ5ð8$ð ð8$ð ��U˜3 ˜8‘_Ð$Ñ%ð	8$ð
 �uÐ/Ñ0Ñ1ð8$ð ˜U 8¨UÐ3EÑ-FÈÐ#PÑQÑRð8$ð ˜#˜x˜-Ñ(ð8$ð ˜‘]ô8$ð~ !ò	DØ
�3˜�8Ñ
ðDà
ðDð ðDð �T‰zð	Dð
 	õDðN5 d¨3°¨8¡nô 5÷^ñ ^÷B^ñ ^òBðGXØ˜˜S˜‘>ðGXà˜˜c˜‘N U¨3¡ZÑ/°$°s±)Ñ;¸dÑBôGXðTpØ˜˜S˜‘>ðpà˜˜c˜‘N U¨3¡ZÑ/°$°s±)Ñ;¸dÑBðpð 
ˆ*ÑôpðfØ˜˜c˜‘N U¨3¡ZÑ/°$°s±)Ñ;¸dÑBôð(HLØ	ðHLà˜˜c˜‘N U¨3¡ZÑ/°$°s±)Ñ;ðHLð 
ˆ#ˆsˆ(�^�e˜C‘jÑ  4¨¡9Ñ,õHLr.   