+
    \åûj‰  ã                   ó,  € ^ RI Ht ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
HtHt ^ RIHtHt . ROt]! R	R
7      R R l4       t]! R	R
7       ! R R]4      4       t]! R	R
7      RR R ll4       t]! R	R
7      R R l4       t]! R	R
7      R R l4       tR# )é    )Ú
NamedTupleN)Úcompatibility)ÚGraph)ÚGraphModule)Úmap_argÚNodeÚTarget)Ú	ShapePropÚTensorMetadataÚ
size_bytesF)Úis_backward_compatiblec                óX   € V ^8„  d   QhR\         R\        R\        R\        R\        RR/# )é   Ú	fx_moduleÚold_opÚ
old_targetÚnew_opÚ
new_targetÚreturnN)r   Ústrr	   )Úformats   "Ú^C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\fx\passes\graph_manipulation.pyÚ__annotate__r      sD   € ÷  ñ  Üð äð ô ð ô ð	 ô
 ð ð 
ñ ó    c                ó<  a	€ \        4       p/ o	V P                  P                   Fî  pVP                  V8X  dÂ   VP                  V8X  d±   \        VP                  V	3R l4      p\        VP                  V	3R l4      p\        V\        4      '       g   \        R\        V4       24      h\        V\        4      '       g   \        R\        V4       24      hVP                  W4WxVP                  4      S	V&   KÕ  VP                  VV	3R l4      S	V&   Kð  	  WPn        R# )z‘
Modifies all nodes in fx_module.graph.nodes which match the specified op code
and target, and updates them to match the new op code and target.
c                 ó   <€ SV ,          # ©N© ©ÚnÚval_maps   &€r   Ú<lambda>Ú+replace_target_nodes_with.<locals>.<lambda>$   s	   ø€ °¸¶
r   c                 ó   <€ SV ,          # r   r   r   s   &€r   r"   r#   %   s	   ø€ °G¸A¶Jr   zExpected tuple, got zExpected dict, got c                 ó   <€ SV ,          # r   r   r   s   &€r   r"   r#   .   s	   ø€ ÀÈÆ
r   N)r   ÚgraphÚnodesÚopÚtargetr   ÚargsÚkwargsÚ
isinstanceÚtupleÚAssertionErrorÚtypeÚdictÚcreate_nodeÚnameÚ	node_copy)
r   r   r   r   r   Ú	new_graphÚnoder*   r+   r!   s
   &&&&&    @r   Úreplace_target_nodes_withr6      så   ø€ ô “€IØ "€GØ—‘×%Ô%ˆØ�7‰7�fÔ §¡°
Ô!:Ü˜4Ÿ9™9Ô&:Ó;ˆDÜ˜TŸ[™[Ô*>Ó?ˆFÜ˜d¤E×*Ò*Ü$Ð';¼DÀ»J¸<Ð%HÓIÐIÜ˜f¤d×+Ò+Ü$Ð':¼4À»<¸.Ð%IÓJÐJØ%×1Ñ1Ø D°$·)±)óˆG�D‹Mð &×/Ñ/°Ô6JÓKˆG�D‹Mñ &ð  †Or   c                   ó,   a € ] tR t^2t o V 3R ltRtV tR# )r   c                ó2   <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   # )r   Úoutput_sizeÚ
total_size)Úint)r   Ú__classdict__s   "€r   r   Úsize_bytes.__annotate__2   s   ø‡ ‚ áÑñ ñ �Oò r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r<   s   @r   r   r   2   s   ø‡ ‡ „ r   c                ól   € V ^8„  d   QhR\         R\        \        P                  ,          R,          RR/# )r   r   r*   Nr   )r   ÚlistÚtorchÚTensor)r   s   "r   r   r   9   s2   € ÷ ñ ÜðÜ"&¤u§|¡|Õ"4°tÕ";ðà	ñr   c                óÂ   € Ve   \        V 4      P                  ! V!   V P                  P                   F'  pVP                  R8X  d    R# \        W4      Vn        K)  	  R# )zÀGiven a fx graph module, update each node with its total size (weights + bias + output)
and its output_size(output). For a non-module node, the total size is the output size.
return total sizeNÚoutput)r
   Ú	propagater&   r'   r(   Úget_size_of_noder   )r   r*   r5   s   && r   Úget_size_of_all_nodesrM   8   sV   € ð Òä�)Ó×&Ò&¨Ò-à—‘×%Ô%ˆØ�7‰7�hÔØá
ô +¨9Ó;ˆŽñ &ñ r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   r5   r   )r   r   )r   s   "r   r   r   K   s   € ÷ 	ñ 	œ$ð 	¤>ñ 	r   c                 ój   € V P                   P                  R 4      pV'       g   \        RV  R24      hV# )Útensor_metazNode zQ has no tensor metadata associated with it! Check that shape propagation has run.)ÚmetaÚgetÚRuntimeError)r5   rP   s   & r   Úget_tensor_metarT   J   s=   € à—)‘)—-‘- Ó.€KçÜØ�D�6ð 4ð 5ó
ð 	
ð
 Ðr   c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   r   r5   r   )r   r   r   )r   s   "r   r   r   X   s!   € ÷ /ñ /¤ð /´4ð /¼Jñ /r   c                óV  € ^ pVP                   R8X  d]   \        V P                  4       4      pW1P                  ,          pVP	                  4       pV F  w  rgW'P                  4       ,          pK  	  \        V4      pVP                  P                  4       p	W),          pVP                  '       d2   \        P                  ! . VP                  R7      P                  4       p
M0\        P                  ! . VP                  R7      P                  4       p
W¢,          pW©,          p\        WË4      # )z‚Given a node with node.dtype and node.shape, return its total size and its output size.
total_size = weights + bias + output_size
Úcall_module)Údtype)r(   r0   Únamed_modulesr)   Únamed_parametersÚnumelrT   ÚshapeÚis_quantizedrG   Ú_empty_affine_quantizedrX   Úelement_sizeÚtensorr   )r   r5   Útotal_num_of_elemsÚsubmodule_dictÚ	submoduleÚ
parametersÚ_nameÚprP   Úoutput_elemÚsize_per_elem_bytesr:   r9   s   &&           r   rL   rL   W   sõ   € ð Ðà‡w�w�-ÔÜ˜i×5Ñ5Ó7Ó8ˆØ"§;¡;Õ/ˆ	Ø×/Ñ/Ó1ˆ
ã"‰HˆEØ§'¡'£)Õ+Òñ #ô " $Ó'€KØ×#Ñ#×)Ñ)Ó+€KØÕ%Ðà××ÐÜ#×;Ò;Ø�k×'Ñ'ô
ç
‰,‹.ñ 	ô $Ÿlšl¨2°[×5FÑ5FÔG×TÑTÓVÐØ$Õ9€JØ%Õ3€KÜ�kÓ.Ð.r   )r6   r   rM   rT   rL   r   )Útypingr   rG   Útorch.fx._compatibilityr   Útorch.fx.graphr   Útorch.fx.graph_moduler   Útorch.fx.noder   r   r	   Útorch.fx.passes.shape_propr
   r   Ú__all__r6   r   rM   rT   rL   r   r   r   Ú<module>rp      s¨   ðÝ ã Ý 1Ý  Ý -ß /Ñ /ß @ò€ñ  eÔ,ô ó -ð ñ:  eÔ,ô�ó ó -ðñ
  eÔ,öó -ðñ"  eÔ,ô	ó -ð	ñ  eÔ,ô/ó -ò/r   