
    Vh_                     L    d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d Z
d Zy)	    )GraphDef)NodeDef)
VersionDef)	AttrValue)TensorShapeProtoc                 Z    dd l }|j                  |       }|j                  }t        |      S )Nr   )onnxloadgraphparse)fnamer	   mgs       S/home/dcms/DCMS/lib/python3.12/site-packages/torch/utils/tensorboard/_onnx_graph.pyload_onnx_graphr   	   s%    		%A	A8O    c                    g }dd l }t        |j                  | j                  | j                              }|D ]  }t        |j                         t        |j                  j                  j                  j                  D cg c]"  }t        j                  |j                        $ c}      }|j                  t        |j                  j!                  d      dg t#        |j                  j                  j$                        t#        |      d	
              | j&                  D ]  }|j(                  D cg c];  }dj+                  |j-                         D cg c]  }t/        |d          c}      = }	}}dj+                  |	      j!                  d      }
t        |j                  d          |j                  t        |j                  d   j!                  d      |j0                  |j                  dt#        |
      i
              i }|D ]+  }|j2                  dz   |j                  z   ||j                  <   - t5        |t7        d            S c c}w c c}w c c}}w )Nr   )size)dimutf_8)encodingVariable)type)shape)dtyper   )nameopinputattrz =    z, 
parameters)s_   )producer)nodeversions)	itertoolslistchainr   outputprintr   r   r   tensor_typer   r   Dim	dim_valueappendr   encoder   	elem_typer&   	attributejoin
ListFieldsstrop_typer   r   r   )r   nodesr(   nodes_protor&   d
shapeprotor"   f_attrr   mappings               r   r   r      s   Eyu{{ELLABK 
dii% ..4488 !$$!++6

 	YY%%w%7&DII,A,A,K,KL&Z8	
	

( 

 
JN..YQ?1S1Y?@YYyy&&&8dkk!n[[^**G*<<<jj"I$56		
	
 G 7!WWs]TYY6		7 R)@AAG$ @Ys   'I
="I)I$4	I)$I)N)"tensorboard.compat.proto.graph_pb2r   %tensorboard.compat.proto.node_def_pb2r   %tensorboard.compat.proto.versions_pb2r   'tensorboard.compat.proto.attr_value_pb2r   )tensorboard.compat.proto.tensor_shape_pb2r   r   r    r   r   <module>rE      s    7 9 < = F,Br   