+
    [åûj^7  ã                  ó°   € R t ^ RIHt ^ RIt^ RIHt ^ RIHtHt ^ RI	t	^ RI
Hu Ht ^ RIHtHtHtHtHtHtHtHt ]'       d   ^ RIHt R R ltR	 R
 ltR# )ap  Bind a ``ShapesSpec``/``ParamsSpec`` to a callable's flat ``(args, kwargs)``.

These helpers are pure spec->args binding (``pytree`` + ``inspect`` + the spec
types); they do NOT touch sympy or the ShapeEnv, so they live at the fx layer
and are imported by make_fx, strict export, and non-strict export alike (instead
of make_fx depending on the dynamo export module).
)ÚannotationsN)Úzip_longest)ÚAnyÚTYPE_CHECKING)ÚDictSpecÚIntermediateSpecÚIntVarÚLeafSpecÚ
ObjectSpecÚSeqSpecÚ
ShapesSpecÚ
TensorSpec)ÚCallablec               ó(   € V ^8„  d   QhRRRRRRRR/# )	é   Ú	user_speczIntermediateSpec | NoneÚ	arg_valuer   ÚwhereÚstrÚreturnzlist[LeafSpec]© )Úformats   "Ú_C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\fx\experimental\_spec_binding.pyÚ__annotate__r   !   s6   € ÷ Dñ DØ&ðDàðDð ðDð ñ	Dó    c                ó
  € V f(   R.\        \        P                  ! V4      4      ,          # \        V \        4      '       dÈ   \        V\
        \        34      '       g$   \        V R\        V4      P                   24      hV P                  p\        V4      \        V4      8”  d&   \        V R\        V4       R\        V4       24      h. p\        \        W4      4       F"  w  pw  rgV\        WvV RV R2R7      ,          pK$  	  V# \        V \        4      '       dñ   \        V\        4      '       g$   \        V R\        V4      P                   24      h\!        V 4      \!        V4      ,
          pV'       dB   \        V R	\#        V\$        R
7      : R\#        VP'                  4       \$        R
7      : 24      h. pVP)                  4        F;  w  r–W�9   d   V P                  V	,          MRpV\        WvV RV	: R2R7      ,          pK=  	  V# \        V \*        4      '       Edë   \        P,                  ! V4      p
\        P.                  P1                  V
4      pVf%   \        V R\        V4      P                   R24      hVP2                  f%   \        V R\        V4      P                   R24      hVP3                  V4      w  rÍV UUu0 uF3  w  rí\        V\        P4                  4      '       g   K'  VP6                  kK5  	  ppp\!        V 4      V,
          pV'       d>   \        V R\#        V4      : R\        V4      P                   R\#        V4      : 24      h. pV F¦  w  pp\        V\        P4                  4      '       dS   VP6                  V 9   dB   V\        V P8                  VP6                  ,          VV RVP6                   2R7      ,          pKx  VR.\        \        P                  ! V4      4      ,          ,          pK¨  	  V# \        V \:        4      '       dI   \        V\<        P>                  4      '       g%   \        V R\        V4      P                   R24      h V .# \        V \@        \B        34      '       dU   \        V\B        4      '       g;   \        V R\        V 4      P                   R\        V4      P                   R24      h V .# \E        V R\        V 4      P                   24      hu uppi )aç  Return the flat leaf-spec list for ``arg_value`` (one entry per
``pytree.tree_flatten`` leaf, ``None`` = static), pairing each leaf with its
``user_spec`` counterpart.

Container specs (``SeqSpec`` / ``DictSpec`` / ``ObjectSpec``) recurse and
concatenate their children's lists, so leaves land in the same order
``pytree.tree_flatten`` produces:

- **list / tuple** (``SeqSpec`` or no-spec subtree): iterate via plain
  ``enumerate(seq)`` -- matches pytree's ``_list_flatten`` /
  ``_tuple_flatten`` (a namedtuple, being a tuple, is handled by position
  here).
- **dict** (``DictSpec`` or no-spec subtree): iterate ``arg_value.items()``
  (insertion order); pytree's ``_dict_flatten`` does ``list(d.values())``.
- **pytree-registered objects** (``ObjectSpec``): use the type's registered
  ``flatten_with_keys_fn`` -- the same function pytree dispatches to.

No flat-index bookkeeping: parents just concatenate child lists. ``where`` is
a human-readable path string used solely for error messages.
Nz#: SeqSpec expected list/tuple, got z: SeqSpec has z( entries beyond runtime sequence length Ú[Ú]©r   z: DictSpec expected dict, got z: DictSpec has entries )Úkeyz> that do not match any key in the runtime dict. Runtime keys: zL: ObjectSpec requires the runtime value's type to be pytree-registered, but z… is not registered. Register it via `torch.export.register_dataclass(<cls>)` (for dataclasses) or `pytree.register_pytree_node(...)`.zC: export requires `flatten_with_keys_fn` to be registered for type zœ, but none was found. Re-register via `pytree.register_pytree_node(..., flatten_with_keys_fn=...)` or use `torch.export.register_dataclass` for dataclasses.z: ObjectSpec has entries z? that do not match any attribute on the runtime object of type z. Available attributes: Ú.z+: spec is TensorSpec but the actual arg is z, not a Tensor.z
: spec is z% (scalar spec) but the actual arg is z
, not int.z: unexpected leaf spec type )#ÚlenÚpytreeÚtree_leavesÚ
isinstancer   ÚlistÚtupleÚ
ValueErrorÚtypeÚ__name__Ú_entriesÚ	enumerater   Ú
_walk_specr   ÚdictÚsetÚsortedÚreprÚkeysÚitemsr
   Ú_get_node_typeÚSUPPORTED_NODESÚgetÚflatten_with_keys_fnÚ
GetAttrKeyÚnameÚ_fieldsr   ÚtorchÚTensorr   ÚintÚAssertionError)r   r   r   ÚentriesÚoutÚiÚvalueÚsub_specÚ	unmatchedr   Ú	node_typeÚhandlerÚkey_childrenÚ_ÚkeÚavailable_namesÚ	key_entryÚchilds   &&&               r   r,   r,   !   sÑ  € ð6 ÒØˆvœœF×.Ò.¨yÓ9Ó:Õ:Ð:ä�)œW×%Ò%Ü˜)¤d¬E ]×3Ò3ÜØ�'Ð<¼TÀ)»_×=UÑ=UÐ<VÐWóð ð ×$Ñ$ˆÜˆw‹<œ#˜i›.Ô(ÜØ�'˜¬¨G« ~ð 6#Ü#& y£>Ð"2ð4óð ð !ˆÜ$-¬k¸)Ó.MÖ$NÑ ˆAÑ �Ø”:˜h¸°w¸aÀ¸sÀ!°_ÔEÕEŠCñ %Oàˆ
ä�)œX×&Ò&Ü˜)¤T×*Ò*ÜØ�'Ð7¼¸Y»×8PÑ8PÐ7QÐRóð ô ˜	“N¤S¨£^Õ3ˆ	ßÜØ�'Ð0´¸	ÄtÔ1LÑ0Oð P!ä!'¨	¯©Ó(8¼dÔ!CÑ FðHóð ð ˆØ#Ÿ/™/Ö+‰JˆCØ25Ô2B�y×)Ñ)¨#Ö.ÈˆHØ”:˜h¸°w¸aÀ¹wÀaÐ5HÔIÕIŠCñ ,ð ˆ
ä�)œZ×(Ó(Ü×)Ò)¨)Ó4ˆ	Ü×(Ñ(×,Ñ,¨YÓ7ˆØŠ?ÜØ�'ð 0Ü04°Y³×0HÑ0HÐ/Ið J9ð:óð ð ×'Ñ'Ò/ÜØ�'ð Dä˜	“?×+Ñ+Ð,ð -LðMóð ð "×6Ñ6°yÓA‰ˆñ ".ô
Ù!-™˜´¸BÄ×@QÑ@Q×1RŒGˆB�GŒG¡ð 	ñ 
ô ˜	“N _Õ4ˆ	ßÜØ�'Ð2´6¸)Ó3DÑ2Gð Hä 	›?×3Ñ3Ð4ð 5Ü% oÓ6Ñ9ð;óð ð ˆÛ ,ÑˆI�uô ˜)¤V×%6Ñ%6×7Ò7¸I¿N¹NÈiÔ<WØ”zØ×%Ñ% i§n¡nÕ5ØØ"˜G 1 Y§^¡^Ð$4Ð5ôõ ’ð ˜�v¤¤F×$6Ò$6°uÓ$=Ó >Õ>Õ>’ñ !-ð ˆ
ô �)œZ×(Ò(Ü˜)¤U§\¡\×2Ò2ÜØ�'ÐDÜ˜	“?×+Ñ+Ð,¨Oð=óð ð 3ð  ˆ;Ðô 
�I¤¬˜}×	-Ò	-Ü˜)¤S×)Ò)ÜØ�'˜¤D¨£O×$<Ñ$<Ð#=ð >7ä˜	“?×+Ñ+Ð,¨Jð8óð ð *ð ˆ;Ðô ØˆgÐ1´$°y³/×2JÑ2JÐ1KÐLó
ð 	
ùóQ
s   Ë$TË6Tc          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   ÚfzCallable[..., Any]Úargsr   Úkwargszdict[str, Any] | NoneÚshapes_specr   r   z1tuple[list[LeafSpec], list[Any], pytree.TreeSpec]r   )r   s   "r   r   r   ¨   sA   € ÷ U.ñ U.ØðU.à
ðU.ð "ðU.ð ð	U.ð
 7ñU.r   c           	     ó*  € VP                   pT;'       g    / p\        P                  ! W34      w  rVVf   R.VP                  ,          WV3# VP                  pVP
                  p\        V \        P                  P                  4      '       d!   \        P                  ! V P                  4      M\        P                  ! V 4      p	\        V	P                  P                  4       4      p
\!        V
4      p\#        V
4       F1  w  rÍVP$                  \        P&                  P(                  J g   K/  Tp M	  VP                  p. p\+        4       p\+        4       p\#        VRV 4       FV  w  ppW¬,          P,                  pVV9   d   VP/                  V4       VV,          pMRpV\1        VVRV: R2R7      ,          pKX  	  \!        V4      V,
          p\        T;'       g    . 4      pVR.\3        ^ V\!        V4      ,
          4      ,          ,          p\#        WR 4       F(  w  ppVV,          pV\1        VVRV R2R7      ,          pK*  	  VP4                  pVP7                  4        Fj  w  ppVV9   d   VV,          pVP/                  V4       M(Ve#   VV9   d   VV,          pVP/                  V4       MRpV\1        VVRV: R2R7      ,          pKl  	  \+        V4      V,
          pVe   V\+        V4      V,
          ,          pV'       dZ   \!        VRV 4      pV
RV  Uu. uF  qÝP,                  NK  	  up\        V4      ,           p\9        R\;        V4      : RV: R24      h\!        V4      V8w  d   \=        R	\!        V4       R
V R24      hWõV3# u upi )a”  Bind a user-provided ``ShapesSpec`` to the actual ``(args, kwargs)``
by inspecting ``f``'s signature, producing:
  - an aligned leaf-spec list ordered to match
    ``pytree.tree_flatten((args, kwargs))``,
  - the flat args list, and
  - the pytree TreeSpec for ``(args, kwargs)``,
all from a single ``pytree.tree_flatten`` call (callers don't need to
re-flatten).

The leaf-spec list has length equal to the flat leaf count, with
``None`` at every position that should be treated as static.

Consumers: the strict export tracer re-wraps this list into a
``ShapesSpec``; the non-strict tracer and ``make_fx`` iterate it and
pair each entry with its flat input.
Nzshapes_spec[r   r   zshapes_spec['*args'][zParamsSpec has entries zŠ that do not match any argument passed to export(). Spec keys must be forward parameter names that were actually passed. Inputs received: r    z,_bind_spec_to_args leaf-count drift: walked z7 leaves but pytree.tree_flatten((args, kwargs)) yields zT. This means the translator and the export tracer disagree on the flat input layout.)Ú_paramsr"   Útree_flattenÚ
num_leavesÚ_named_argsÚ_varargsr$   r:   ÚnnÚModuleÚinspectÚ	signatureÚforwardr%   Ú
parametersÚvaluesr!   r+   ÚkindÚ	ParameterÚVAR_POSITIONALr.   r8   Úaddr,   ÚmaxÚ_varkwr2   r'   r/   r=   )rM   rN   rO   rP   Úparams_specÚ	flat_argsÚin_specÚparams_spec_named_argsÚparams_spec_varargsÚsigÚ
pos_paramsÚvarargs_idxr@   ÚpÚtotal_leavesÚout_leaf_specsÚmatched_named_keysÚmatched_varkw_keysr   Úarg_namer   Ún_actual_varargsÚuser_idxÚparams_spec_varkwrC   Ún_named_positionalÚpasseds   &&&&                       r   Ú_bind_spec_to_argsrw   ¨   s   € ð, ×%Ñ%€KØ�\ˆ\�r€FÜ×,Ò,¨d¨^Ó<Ñ€IØÒð ˆv˜×*Ñ*Õ*¨IÐ>Ð>à(×4Ñ4ÐØ%×.Ñ.Ðô �aœŸ™Ÿ™×)Ò)ô 	×Ò˜!Ÿ)™)Ô$ä×Ò˜qÓ!ð ô
 �c—n‘n×+Ñ+Ó-Ó.€Jô0 �j“/€KÜ˜*Ö%‰ˆØ�6‰6”W×&Ñ&×5Ñ5Õ5ØˆKÙñ &ð ×%Ñ%€Lð
 &(€Nô $'£5ÐÜ#&£5Ðô
 " $ |¨Ð"4Ö5‰ˆˆ9Ø•=×%Ñ%ˆØÐ-Ô-Ø×"Ñ" 8Ô,Ø.¨xÕ8‰IàˆIØœ*Ø�y¨,°x±lÀ!Ð(Dô
õ 	
Šñ 6ô ˜4“y ;Õ.ÐÜÐ2×8Ð8°bÓ9ÐØ˜D˜6¤C¨Ð+;¼cÐBUÓ>VÕ+VÓ$WÕWÕWÐô  )¨¨lÐ);Ö<Ñˆ�)Ø'¨Õ1ˆ	Øœ*Ø�yÐ*?À¸zÈÐ(Kô
õ 	
Šñ  =ð $×*Ñ*ÐØ%Ÿ|™|ž~Ñˆ�)ØÐ-Ô-Ø.¨xÕ8ˆIØ×"Ñ" 8Õ,ØÒ*¨xÐ;LÔ/LØ)¨(Õ3ˆIØ×"Ñ" 8Õ,àˆIØœ*Ø�y¨,°x±lÀ!Ð(Dô
õ 	
Šñ  .ô Ð*Ó+Ð.@Õ@€IØÒ$Ø”SÐ*Ó+Ð.@Õ@Õ@ˆ	ßÜ   l {Ð!3Ó4ÐØ",Ð-@Ð.@Ñ"AÓBÑ"A˜Q—&”&Ñ"AÑBÄTÈ&Ã\ÕQˆÜØ%¤f¨YÓ&7Ñ%:ð ;Kð ‰j˜ðó
ð 	
ô ˆ>Ó˜lÔ*ÜØ:¼3¸~Ó;NÐ:Oð PEØEQÀNð S!ð"ó
ð 	
ð  gÐ-Ð-ùò% Cs   ÌN)Ú__doc__Ú
__future__r   rY   Ú	itertoolsr   Útypingr   r   r:   Útorch.utils._pytreeÚutilsÚ_pytreer"   Ú"torch.fx.experimental.dynamic_specr   r   r   r	   r
   r   r   r   Úcollections.abcr   r,   rw   r   r   r   Ú<module>r�      sE   ðñõ #ã Ý !ß %ã ß $Ð $÷	÷ 	ó 	÷ Ý(õD÷NU.r   