
    Bj[                         d dl Z d dlmZ d dlZd dlmZ 	 ddedej        j        de	dz  dedef
d	Z
ded
ededefdZdej        j        deeef         dz  fdZddej        j        de	defdZdS )    N)Any)
LazyStringnamegmmaybe_idkwargsreturnc                      dt           f fddvrdd<   dv r:	 t          j                                        sdd<   n# t          $ r dd<   Y nw xY wt          fd          S )z;
    Returns a LazyString that formats the graph code.
    r	   c                        d  S S )N  )r   r   s   R/var/www/html/Carbon-Document/venv/lib/python3.11/site-packages/torch/fx/_utils.pyformat_namez+lazy_format_graph_code.<locals>.format_name   s"    ''X'''K    print_outputFcoloredc            	      r    t          d               dj        j        j         j        di           S )Nz===== z =====
r   )_format_graph_codeforward__code__co_filenameprint_readable)r   r   r   s   r   <lambda>z(lazy_format_graph_code.<locals>.<lambda>    sG    ",[[]],,,J+B''''
 
 r   )strsysstdoutisattyAttributeErrorr   )r   r   r   r   r   s   ````@r   lazy_format_graph_coder      s            V##!&~F	&:$$&& *$)y! 	& 	& 	& %F9	& 	
 	
 	
 	
 	
 	
  s   #A AAfilename	graph_strc                     d|  d| d| dS )z7
    Returns a string that formats the graph code.
    zTRACED GRAPH
 r   
r   )r   r    r!   s      r   r   r   (   s%     =T<<H<<y<<<<r   graphc                 `    | j         D ]%}|j        dk    rd|j        v r|j        d         c S &dS )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,   /   sI      0 07o%%*;ty*H*H9.////4r      r+   	num_nodesc                     g }| }t          |          D ]J}|                    t          |                                                     |j        dk    r n|j        }Kd                    |ddd                   S )zD
    Returns a string of the last num_nodes nodes in the graph.
    rootr#   N)rangeappendr   format_noder)   prevjoin)r+   r.   node_contextscur_s        r   get_node_contextr:   9   s     M
C9  S!2!2334446VEh99]44R4()))r   )N)r-   )r   typingr   torchtorch._loggingr   r   fxGraphModuleintr   r   Graphdictr,   Noder:   r   r   r   <module>rD      s-   



        % % % % % % AE 
8'36:PS   @=S =C =C =C = = = =ux~ $sCx.SWBW    * *58= *S * * * * * * *r   