
     Tic"                        S r SSKJr  S/rSSKrSSKrSSKJrJr  SSK	J
r
  SSKrSSKrSS jrSS jrSS	 jrSS
 jr S       SS jjrg)zUtilities for testing.    )annotationsassert_onnx_proto_equalN)
CollectionSequence)Anyc                2    U R                   U R                  4$ N)domainversion)opset_imports    N/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/onnx_ir/testing.py_opset_import_keyr      s    !5!566    c                    U R                   $ r	   )name)
value_infos    r   _value_info_keyr      s    ??r   c                J    U R                   U R                  [        U SS5      4$ )Noverload )r
   r   getattr)functions    r   _function_keyr      s     OOX]]GHj",MNNr   c                ~    [        5       n/ nU  H*  nX1;   a  UR                  U5        UR                  U5        M,     U$ )z5Return a list of duplicated elements in a collection.)setappendadd)with_duplicatesseen
duplicatesxs       r   _find_duplicatesr"       s>    5DJ9a   r   c                |   [        U 5      [        U5      L d   S[        U 5       S[        U5       35       eU R                  5        VVs0 s H  u  p4UR                  U_M     nnnUR                  5        VVs0 s H  u  p4UR                  U_M     nnn[        [	        UR                  5       5      [	        UR                  5       5      -  5      n[        U [        R                  5      (       aj  [        U[        R                  5      (       aK  U R                   Vs1 s H  oR                  iM     n	nUR                   Vs1 s H  oR                  iM     n
nO[	        5       n	[	        5       n
/ nU GHj  n[        X5      n[        X5      n[        U[        5      (       Ga@  [        U[        5      (       Ga*  [        U[        [        45      (       Gd  [        U[        [        45      (       Gd  / n/ nUS:X  aT  [        U[        S9n[        U[        S9nU Vs/ s H  n[        U5      PM     nnU Vs/ s H  n[        U5      PM     nnGO>US:X  a  U(       a  [        U [        R                  5      (       ag  [        U[        R                  5      (       aH  U Vs/ s H  nUR                  U	;  d  M  UPM     nnU Vs/ s H  nUR                  U
;  d  M  UPM     nn[        U[        S9n[        U[        S9nU Vs/ s H  n[        U5      PM     nnU Vs/ s H  n[        U5      PM     nnOXUS:X  aR  [        U[         S9n[        U[         S9nU Vs/ s H  n[!        U5      PM     nnU Vs/ s H  n[!        U5      PM     nnX:w  aq  [	        U5      [	        U5      -
  n[	        U5      [	        U5      -
  nSU SU S	U S
[        U5       S[#        U5       S[#        U5       3nUR%                  U5        GM  ['        U5      ['        U5      :w  a=  SU S['        U5       S['        U5       S[        U5       3nUR%                  U5        GM  [)        ['        U5      5       GHo  nX   nX   n[        U[*        R,                  R.                  R0                  5      (       aA  [        U[*        R,                  R.                  R0                  5      (       a   [3        UUUS9  M  UU:w  d  M  [        U[6        5      (       aM  [        U[6        5      (       a8  [8        R:                  " U5      (       a  [8        R:                  " U5      (       a  M  SU SU S[        U5       S[        U5       3n[<        R>                  " [        U5      RA                  5       [        U5      RA                  5       5       H  nUSU-   -  nM     UR%                  U5        GMr     GMp  [        U[*        R,                  R.                  R0                  5      (       a@  [        U[*        R,                  R.                  R0                  5      (       a  [3        XUS9  GM  X:w  d  GM  [        U[6        5      (       aN  [        U[6        5      (       a9  [8        R:                  " U5      (       a  [8        R:                  " U5      (       a  GMN  SU SU SU 3nUR%                  U5        GMm     U(       a6  [5        S[        U 5       S[        U5       S3SRC                  U5      -   5      egs  snnf s  snnf s  snf s  snf s  snf s  snf s  snf s  snf s  snf s  snf s  snf s  snf ! [4         aT  nSU SU S[        U5       S[        U5       SU SU 3n[        U5      S-   U-   nUR%                  U5         SnAGMK  SnAff = f)a  Assert that two ONNX protos are equal.

Equality is defined as having the same fields with the same values. When
a field takes the default value, it is considered equal to the field
not being set.

Sequential fields with name `opset_import`, `value_info`, and `functions` are
compared disregarding the order of their elements.

Args:
    actual: The first ONNX proto.
    expected: The second ONNX proto.
    ignore_initializer_value_proto: Ignore value protos for initializers if there
        are extra ones in the actual proto.
zType not equal: z != r   )keyr   	functionszField z  not equal: keys_only_in_actual=z, keys_only_in_expected=z. Field type: z. Duplicated a_keys: z, duplicated b_keys: z not equal: len(a)=z	, len(b)=z Field type: )ignore_initializer_value_protoz index z. in sequence not equal. type(actual_value_i): z, type(expected_value_i): z, actual_value_i: z, expected_value_i: z

Caused by the above error

N
z not equal. field_actual: z, field_expected: zProtos not equal: )"type
ListFieldsr   sortedr   keys
isinstanceonnx
GraphProtoinitializerr   r   strbytesr   r   r   r"   r   lenrangegoogleprotobufmessageMessager   AssertionErrorfloatmathisnandifflibndiff
splitlinesjoin)actualexpectedr&   fieldvaluea_fieldsb_fields
all_fieldsiactual_initializer_namesexpected_initializer_nameserrorsa_valueb_valuea_keysb_keysr   r   r%   keys_only_in_actualkeys_only_in_expectederror_messageactual_value_iexpected_value_ielines                             r   r   r   +   sb   ( <4>) 
4<.T(^,<=) 7=6G6G6IJ6Ile

E!6IHJ6>6I6I6KL6Kle

E!6KHLHMMO,s8==?/CCDJ&$//**z(DOO/T/T4:4F4F#G4FqFF4F #G6>6J6J%K6Jff6J"%K"#&5 %(U" F&((*w))7H--we55we55 !#F "F& .?@ .?@NUVgl+L9gVNUVgl+L9gV,&2"64??;;"8T__==
 +2*1J%??2JJ #*1   +2*1J%??2LL #*1  
 !o> o>HOP*/*5PHOP*/*5P+% m< m<DKLGy-	2GLDKLGy-	2GL&)&kCK&?#(+Fc&k(A%UG#CDWCXXp  rG  qH H##'=/ 2**:6*B)CCXYijpYqXrt 
 m,WW-UG#6s7|nIcRYl^ \##'=/3  m, s7|,A%,ZN'.z$!&(?(?(G(G $%5v7N7N7V7VWW93 . 0?] (+;;&~u== *+;U C C $

> : : $

+; < < %*0wqcAopt  vD  qE  pF  F`  ae  fv  aw  `x  )y$+MM/::< 01<<>%D *TD[8M	%
 m4C -D !8!8!@!@AAjV__,,44G
 G
 $A_ 7E**w..JJw''JJw'' 9'BTU\T]^  MM-(e f  fd4>2B"E		RXHYY
 	
  KL $H%K. WV
 QP ML>  . 9.4UG71#Estx  zH  uI  tJ  Jd  ei  jz  e{  d|  |N  O]  N^  ^r  sC  rD  -EM #A)L L} \ * #MM-889sm   
\9\%\+\0\55\:\?5\?]]]	]]5]]
^;'A^66^;)r   zonnx.OperatorSetIdProtoreturnztuple[str, int])r   zonnx.ValueInfoProtorV   r0   )r   zonnx.FunctionProtorV   ztuple[str, str, str])r   zCollection[Any]rV   z	list[Any])F)r@   %google.protobuf.message.Message | AnyrA   rW   r&   boolrV   None)__doc__
__future__r   __all__r<   r:   collections.abcr   r   typingr   google.protobuf.messager4   r-   r   r   r   r"   r    r   r   <module>ra      su     "    0   7O ,1Z
1Z
3Z
 %)Z
 
	Z
r   