
    SiK                    T    S SK Jr  S SKrS SKrS SKJr  S SKJr  S r	 " S S\5      r
g)    )annotationsN)Base)expectc                    U(       a  / $ U $ )N )xconds     ]/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/onnx/backend/test/case/node/if.pycompute_if_outputsr      s    	H    c                  P    \ rS rSr\SS j5       r\SS j5       r\SS j5       rSrg)If   c            
     R   [         R                  R                  S[         R                  R                  S/5      n [         R                  R                  S[         R                  R                  S/5      n[
        R                  " / SQ5      R                  [
        R                  5      n[
        R                  " / SQ5      R                  [
        R                  5      n[         R                  R                  S/ S/[         R                  R                  U5      S9n[         R                  R                  S/ S/[         R                  R                  U5      S9n[         R                  R                  U/S/ U /5      n[         R                  R                  U/S	/ U/5      n[         R                  R                  S
S/S/UUS9n[
        R                  " S5      R                  [        5      n	U	(       a  UOUn
[        UU	/U
/S[         R                  R                  SS5      /S9  g )Nthen_out   else_out            r   r   r   r   r   r   Constantinputsoutputsvalue	then_body	else_bodyr   r	   resr   r   then_branchelse_branchr   test_if    r   r   nameopset_imports)onnxhelpermake_tensor_value_infoTensorProtoFLOATnparrayastypefloat32	make_nodenumpy_helper
from_array
make_graphboolr   make_opsetid)r   r   r   ythen_const_nodeelse_const_noder   r    if_noder	   r!   s              r
   	export_ifIf.export_if   s   
 ;;55((..
 ;;55((..
 HH_%,,RZZ8HH_%,,RZZ8++//L##..q1	 0 
 ++//L##..q1	 0 
 KK**{B

	 KK**{B

	 ++''8G!! ( 
 xx{!!$'aQ6E;;33B;<	
r   c            
        [         R                  R                  S[         R                  R                  S/S9n [         R                  R                  S[         R                  R                  S/S9n[
        R                  " / SQ5      R                  [
        R                  5      /n[
        R                  " / SQ5      R                  [
        R                  5      /n[         R                  R                  S/ S/[         R                  R                  US	   5      S
9n[         R                  R                  SS/S/S9n[         R                  R                  S/ S/[         R                  R                  US	   5      S
9n[         R                  R                  SS/S/S9n[         R                  R                  XE/S/ U /5      n[         R                  R                  Xg/S/ U/5      n	[         R                  R                  SS/S/UU	S9n
[
        R                  " S5      R                  [        5      nU(       a  UOUn[        U
U/U/S[         R                  R                  SS5      /S9  g )Nr   r   shaper   r   r   r   r   r   r   SequenceConstructr   r   r:   r   r    r   r	   r!   r"   r   test_if_seqr&      r(   )r+   r,   make_tensor_sequence_value_infor.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r   r9   )r   r   r   r:   r;   then_seq_noder<   else_seq_noder   r    r=   r	   r!   s                r
   export_if_seqIf.export_if_seqK   s2   
 ;;>>((..qc ? 
 ;;>>((..qc ? 
 XXo&--bjj9:XXo&--bjj9:++//E##..qt4	 0 
 --
| . 
 ++//E##..qt4	 0 
 --
| . 
 KK**,k2z
	 KK**,k2z
	 ++''8G!! ( 
 xx{!!$'aQ6E;;33B;<	
r   c                 Z   [         R                  R                  [         R                  R                  S/S9n [         R                  R                  U 5      n[         R                  R                  [         R                  R                  S/S9n[         R                  R                  U5      n[         R                  R                  U5      n[         R                  R                  SU5      n[         R                  R                  [         R                  R                  S/S9n[         R                  R                  U5      n[         R                  R                  U5      n[         R                  R                  SU5      n	[        R                  " / SQ5      R                  [        R                  5      /n
[        R                  " S5      R                  [        5      n[        X5      n[         R                  R                  S/ S/US9n[         R                  R                  U/S	/ U/5      n[         R                  R                  S
/ S/[         R                   R#                  U
S   5      S9n[         R                  R                  SS/S/S9n[         R                  R                  SS/S/S9n[         R                  R                  UUU/S/ U	/5      n[         R                  R                  SS/S/UUS9n[%        UU/U/SU/[         R                  R'                  SS5      /S9  g )Nr   rA   optional_emptyelse_optr   r   Optional)r   r   typer   r   r   r   rC   else_seqrD   r    r   r	   sequencer"   test_if_optr&      )r   r   r)   output_type_protosr*   )r+   r,   make_tensor_type_protor.   r/   make_sequence_type_protomake_optional_type_protomake_value_infor0   r1   r2   r3   r8   r   r4   r7   r5   r6   r   r9   )	ten_in_tp	seq_in_tpthen_out_tensor_tpthen_out_seq_tpthen_out_opt_tpr   else_out_tensor_tpelse_out_seq_tpelse_out_opt_tpr   r   r	   r!   opt_empty_inr   r<   rI   else_optional_seq_noder    r=   s                       r
   export_if_optionalIf.export_if_optional   s    KK66""1# 7 
	 KK88C	![[??""1# @ 
 ++>>?QR++>>O;;../?Q![[??""1# @ 
 ++>>?QR++>>O;;..z?KXXo&--bjj9:xx{!!$' ){{,,r,<+=I - 
 KK**L>;XJW	++//E##..qt4	 0 
 --
| . 
 "&!6!6
|j\ "7 "
 KK**m-CDJ	
	 ++''8L!! ( 
 	6E /0;;33B;<	
r   r   N)returnNone)	__name__
__module____qualname____firstlineno__staticmethodr>   rJ   rd   __static_attributes__r   r   r
   r   r      s@    4
 4
l <
 <
| G
 G
r   r   )
__future__r   numpyr0   r+   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r   r   r   r
   <module>rr      s)    #   , .
 
r   