
    Ng               	           d dl Zd dlZd dlmZ d dlmZ ddej        dededej        fd	Z		 ddej        dededej        fdZ
 G d de          ZdS )    N)Base)expect   dataaxiskeepdimsreturnc                     t          j        | |          }|dk    rt          j        ||          }|                    t           j                  S N)r   r   )npargmaxexpand_dimsastypeint64r   r   r   results       ^/var/www/html/ai-engine/env/lib/python3.11/site-packages/onnx/backend/test/case/node/argmax.pyargmax_use_numpyr      sD    Yt$'''F1}}--=="""    Tc                     t          j        | |          } t          j        | |          }| j        |         |z
  dz
  }|rt          j        ||          }|                    t           j                  S r   )r   flipr   shaper   r   r   r   s       r   "argmax_use_numpy_select_last_indexr      sl     74DYt$'''FZ&*F .--=="""r   c                       e Zd Zedd            Zedd            Zedd            Zedd            Zedd            Zedd            Z	edd	            Z
edd
            ZdS )ArgMaxr	   Nc                     t          j        ddgddggt           j                  } d}d}t          j                            ddgd	g||
          }t          | ||          }t          || g|gd           t           j        	                    ddg d          
                    t           j                  } t          | ||          }t          || g|gd           d S )N   r      
   dtyper   r   r   r   inputsoutputsr   r   r   r   test_argmax_no_keepdims_exampler#   r$   namer   r      test_argmax_no_keepdims_randomr   arrayfloat32onnxhelper	make_noder   r   randomuniformr   r   r   r   noder   s        r   export_no_keepdimszArgMax.export_no_keepdims   s	   x!Q!R)<<<{$$fXzx % 
 
 "$THEEE6H2		
 	
 	
 	
 y  b)))44;;BJGG!$THEEE$&8X	
 	
 	
 	
 	
 	
r   c                     t          j        ddgddggt           j                  } d}d}t          j                            ddgdg||	          }t          | ||
          }t          || g|gd           t           j        	                    ddg d          
                    t           j                  } t          | ||
          }t          || g|gd           d S )Nr   r   r   r   r    r   r   r   r"   r%   test_argmax_keepdims_exampler'   r)   r*   test_argmax_keepdims_randomr-   r5   s        r   export_keepdimszArgMax.export_keepdims7   s   x!Q!R)<<<{$$fXzx % 
 
 "$THEEE$&8V	
 	
 	
 	
 y  b)))44;;BJGG!$THEEE$&8U	
 	
 	
 	
 	
 	
r   c                     t          j        ddgddggt           j                  } d}t          j                            ddgdg|	          }t          | |
          }t          || g|gd           t           j        	                    ddg d          
                    t           j                  } t          | |
          }t          || g|gd           d S )Nr   r   r   r   r    r   r   r   )r#   r$   r   r    test_argmax_default_axis_exampler'   r)   r*   test_argmax_default_axis_randomr-   r   r   r6   r   s       r   export_default_axes_keepdimsz#ArgMax.export_default_axes_keepdimsL   s    x!Q!R)<<<{$$fXzH % 
 

 "$:::6H3		
 	
 	
 	
 y  b)))44;;BJGG!$:::6H2		
 	
 	
 	
 	
 	
r   c                     t          j        ddgddggt           j                  } d}d}t          j                            ddgd	g||
          }t          | ||          }t          || g|gd           t           j        	                    ddg d          
                    t           j                  } t          | ||          }t          || g|gd           d S )Nr   r   r   r   r    r   r   r   r"   r%   *test_argmax_negative_axis_keepdims_exampler'   r)   r*   )test_argmax_negative_axis_keepdims_randomr-   r5   s        r   export_negative_axis_keepdimsz$ArgMax.export_negative_axis_keepdimsg   s   x!Q!R)<<<{$$fXzx % 
 
 "$THEEE6H=		
 	
 	
 	
 y  b)))44;;BJGG!$THEEE6H<		
 	
 	
 	
 	
 	
r   c                     t          j        ddgddggt           j                  } d}d}t          j                            ddgd	g||d
          }t          | ||          }t          || g|gd           t           j        	                    ddg d          
                    t           j                  } t          | ||          }t          || g|gd           d S )Nr   r   r   r    r   r   r   r   r   Tr#   r$   r   r   select_last_indexr%   1test_argmax_no_keepdims_example_select_last_indexr'   r)   r*   0test_argmax_no_keepdims_random_select_last_indexr   r.   r/   r0   r1   r2   r   r   r3   r4   r   r5   s        r   $export_no_keepdims_select_last_indexz+ArgMax.export_no_keepdims_select_last_index   s   x!Q!R)<<<{$$8J" % 
 
 4DthWWW6HD		
 	
 	
 	
 y  b)))44;;BJGG3DthWWW6HC		
 	
 	
 	
 	
 	
r   c                     t          j        ddgddggt           j                  } d}d}t          j                            ddgdg||d	
          }t          | ||          }t          || g|gd           t           j        	                    ddg d          
                    t           j                  } t          | ||          }t          || g|gd           d S )Nr   r   r   r    r   r   r   r   TrH   r%   .test_argmax_keepdims_example_select_last_indexr'   r)   r*   -test_argmax_keepdims_random_select_last_indexrL   r5   s        r   !export_keepdims_select_last_indexz(ArgMax.export_keepdims_select_last_index   s   x!Q!R)<<<{$$8J" % 
 
 4DthWWW6HA		
 	
 	
 	
 y  b)))44;;BJGG3DthWWW6H@		
 	
 	
 	
 	
 	
r   c                     t          j        ddgddggt           j                  } d}t          j                            ddgdg|d	
          }t          | |          }t          || g|gd           t           j        	                    ddg d          
                    t           j                  } t          | |          }t          || g|gd           d S )Nr   r   r   r    r   r   r   r   T)r#   r$   r   rI   r=   2test_argmax_default_axis_example_select_last_indexr'   r)   r*   1test_argmax_default_axis_random_select_last_indexrL   r@   s       r   .export_default_axes_keepdims_select_last_indexz5ArgMax.export_default_axes_keepdims_select_last_index   s   x!Q!R)<<<{$$8J" % 
 
 4D8LLL6HE		
 	
 	
 	
 y  b)))44;;BJGG3D8LLL6HD		
 	
 	
 	
 	
 	
r   c                     t          j        ddgddggt           j                  } d}d}t          j                            ddgd	g||d
          }t          | ||          }t          || g|gd           t           j        	                    ddg d          
                    t           j                  } t          | ||          }t          || g|gd           d S )Nr   r   r   r    rC   r   r   r   r   TrH   r%   <test_argmax_negative_axis_keepdims_example_select_last_indexr'   r)   r*   ;test_argmax_negative_axis_keepdims_random_select_last_indexrL   r5   s        r   /export_negative_axis_keepdims_select_last_indexz6ArgMax.export_negative_axis_keepdims_select_last_index   s   x!Q!R)<<<{$$8J" % 
 
 4DthWWW6HO		
 	
 	
 	
 y  b)))44;;BJGG3DthWWW6HN		
 	
 	
 	
 	
 	
r   )r	   N)__name__
__module____qualname__staticmethodr7   r;   rA   rF   rM   rQ   rU   rY    r   r   r   r      s       
 
 
 \
. 
 
 
 \
( 
 
 
 \
4 
 
 
 \
4 
 
 
 \
> 
 
 
 \
> 
 
 
 \
< 
 
 
 \
 
 
r   r   )r   r   )r   T)numpyr   r0   onnx.backend.test.case.baser   onnx.backend.test.case.noder   ndarrayintr   r   r   r^   r   r   <module>rd      s   
      , , , , , , . . . . . .# #2: #S # #BJ # # # # 6:# #
*##/2#Z# # # #a
 a
 a
 a
 a
T a
 a
 a
 a
 a
r   