Ë
    P/æjh  ã                   óŠ   — d dl Z d dlmZmZ d dlZd dlmZ d
d„Zd„ Zdej                  j                  dee   fd„Zddefd	„Zy)é    N)ÚDictÚOptional)Ú
LazyStringc                 ó˜   ‡ ‡‡‡‡— ˆˆ fd„Šd‰vrd‰d<   d‰v r#t         j                  j                  «       sd‰d<   t        ˆˆˆfd„«      S )z;
    Returns a LazyString that formats the graph code.
    c                  ó   •— ‰ �‰› d‰ › �S ‰S )Nú © )Úmaybe_idÚnames   €€úR/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/torch/fx/_utils.pyÚformat_namez+lazy_format_graph_code.<locals>.format_name   s   ø€ ØÐØ�V˜1˜X˜JÐ'Ð'àˆKó    Úprint_outputFÚcoloredc            	      óŒ   •— t        d ‰ «       › d�‰j                  j                  j                   ‰j                  di ‰¤Ž«      S )Nz===== z =====
r	   )Ú_format_graph_codeÚforwardÚ__code__Úco_filenameÚprint_readable)r   ÚgmÚkwargss   €€€r   ú<lambda>z(lazy_format_graph_code.<locals>.<lambda>   sA   ø€ Ô"Ø‘[“]�O 8Ð,Ø�J‰J×Ñ×+Ñ+ØˆB×ÑÑ' Ñ'ó
€ r   )ÚsysÚstdoutÚisattyr   )r   r   r
   r   r   s   ````@r   Úlazy_format_graph_coder   	   sO   ü€ õ
ð ˜VÑ#Ø!&ˆˆ~Ñà�FÑ¤3§:¡:×#4Ñ#4Ô#6Ø!ˆˆyÑäõ	
óð r   c                 ó   — d| › d|› d|› d�S )z7
    Returns a string that formats the graph code.
    zTRACED GRAPH
 r   ú
r	   )r   ÚfilenameÚ	graph_strs      r   r   r   #   s   € ð ˜T˜F ! H :¨Q¨y¨k¸Ð<Ð<r   ÚgraphÚreturnc                 ó„   — | j                   D ]1  }|j                  dk(  sŒd|j                  v sŒ"|j                  d   c S  y)zF
    Returns the nn_module_stack of the first call_function node.
    Úcall_functionÚnn_module_stackN)ÚnodesÚopÚmeta)r"   Únodes     r   Ú#first_call_function_nn_module_stackr+   *   sD   € ð —‘ò 0ˆØ�7‰7�oÓ%Ð*;¸t¿y¹yÒ*HØ—9‘9Ð.Ñ/Ò/ð0ð r   c                 óÐ   — g }| }t        |«      D ]>  }|j                  |j                  «       «       |j                  dk(  r n|j                  }Œ@ dj                  |ddd…   «      S )zD
    Returns a string of the last num_nodes nodes in the graph.
    Úrootr   Néÿÿÿÿ)ÚrangeÚappendÚformat_noder(   ÚprevÚjoin)r*   Ú	num_nodesÚnode_contextsÚcurÚis        r   Úget_node_contextr8   4   si   € ð €MØ
€CÜ�9Óò ˆØ×Ñ˜SŸ_™_Ó.Ô/Ø�6‰6�VÒÙØ�h‰h‰ð	ð
 �9‰9�]¡4 R 4Ñ(Ó)Ð)r   )N)é   )r   Útypingr   r   ÚtorchÚtorch._loggingr   r   r   ÚfxÚGraphr+   Ústrr8   r	   r   r   ú<module>r@      sF   ðã 
ß !ã Ý %óò4=ð¨u¯x©x¯~©~ð À(È4Á.ó ñ*¨3ô *r   