
    NgF                     P    d dl Zd dlZd dlmZ d dlmZ d Z G d de          ZdS )    N)Base)expectc                     |rg S | S )N )xconds     Z/var/www/html/ai-engine/env/lib/python3.11/site-packages/onnx/backend/test/case/node/if.pycompute_if_outputsr
      s     	    c                   V    e Zd Zedd            Zedd            Zedd            ZdS )IfreturnNc            
      D   t           j                            dt           j        j        dg          } t           j                            dt           j        j        dg          }t          j        g d                              t
          j                  }t          j        g d                              t
          j                  }t           j        	                    dg dgt           j
                            |                    }t           j        	                    dg dgt           j
                            |                    }t           j                            |gdg | g          }t           j                            |gd	g |g          }t           j        	                    d
dgdg||          }t          j        d                              t                    }	|	r|n|}
t          ||	g|
gdt           j                            dd          g           d S )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_ifzIf.export_if   s   
 ;55(.
 
 ;55(.
 
 H___%%,,RZ88H___%%,,RZ88+//L#..q11	 0 
 
 +//L#..q11	 0 
 
 K**{B

 
	 K**{B

 
	 +''8G!! ( 
 
 x{{!!$''aaQ6E;33B;;<	
 	
 	
 	
 	
 	
r   c            
         t           j                            dt           j        j        dg          } t           j                            dt           j        j        dg          }t          j        g d                              t
          j                  g}t          j        g d                              t
          j                  g}t           j        	                    dg dgt           j
                            |d	                   
          }t           j        	                    ddgdg          }t           j        	                    dg dgt           j
                            |d	                   
          }t           j        	                    ddgdg          }t           j                            ||gdg | g          }t           j                            ||gdg |g          }	t           j        	                    ddgdg||	          }
t          j        d                              t                    }|r|n|}t          |
|g|gdt           j                            dd          g           d S )Nr   r   shaper   r   r   r   r   r   r   SequenceConstructr   r   r9   r   r   r   r   r    r!   r   test_if_seqr%      r'   )r*   r+   make_tensor_sequence_value_infor-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r   r8   )r   r   r   r9   r:   then_seq_noder;   else_seq_noder   r   r<   r   r    s                r	   export_if_seqzIf.export_if_seqK   ss   
 ;>>(.qc ? 
 
 ;>>(.qc ? 
 
 Xooo&&--bj99:Xooo&&--bj99:+//E#..qt44	 0 
 
 --
| . 
 
 +//E#..qt44	 0 
 
 --
| . 
 
 K**m,k2z
 
	 K**m,k2z
 
	 +''8G!! ( 
 
 x{{!!$''aaQ6E;33B;;<	
 	
 	
 	
 	
 	
r   c                  v   t           j                            t           j        j        dg          } t           j                            |           }t           j                            t           j        j        dg          }t           j                            |          }t           j                            |          }t           j                            d|          }t           j                            t           j        j        dg          }t           j                            |          }t           j                            |          }t           j                            d|          }	t          j	        g d          
                    t          j                  g}
t          j	        d          
                    t                    }t          |
|          }t           j                            dg dg|          }t           j                            |gd	g |g          }t           j                            d
g dgt           j                            |
d                             }t           j                            ddgdg          }t           j                            ddgdg          }t           j                            |||gdg |	g          }t           j                            ddgdg||          }t%          ||g|gd|gt           j                            dd          g           d S )Nr   r?   optional_emptyelse_optr   r   Optional)r   r   typer   r   r   r   rA   else_seqrB   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_infor/   r0   r1   r2   r7   r
   r3   r6   r4   r5   r   r8   )	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;   rG   else_optional_seq_noder   r<   s                       r	   export_if_optionalzIf.export_if_optional   s     K66"1# 7 
 
	 K88CC	![??"1# @ 
 
 +>>?QRR+>>OO;../?QQ![??"1# @ 
 
 +>>?QRR+>>OO;..z?KKXooo&&--bj99:x{{!!$'' D)){,,r,<+=I - 
 
 K**L>;XJWW	+//E#..qt44	 0 
 
 --
| . 
 
 "&!6!6
|j\ "7 "
 "
 K**m-CDJ	
 
	 +''8L!! ( 
 
 	6E /0;33B;;<	
 	
 	
 	
 	
 	
r   )r   N)__name__
__module____qualname__staticmethodr=   rH   ra   r   r   r	   r   r      sz        4
 4
 4
 \4
l <
 <
 <
 \<
| G
 G
 G
 \G
 G
 G
r   r   )	numpyr/   r*   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r
   r   r   r   r	   <module>ri      s   
      , , , , , , . . . . . .  
 
 
 
 
 
 
 
 
 
r   