
    bIg                    T    d dl mZ 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
y)    )annotationsN)Base)expectc                    t        j                  | t         j                        t        j                  |t         j                        t        j                  |t         j                        fS )Ndtype)nparrayint64)indicesinverse_indicescountss      _/var/www/html/answerous/venv/lib/python3.12/site-packages/onnx/backend/test/case/node/unique.pyspecify_int64r      sB    
)
1
rxx(     c                  f    e Zd Zedd       Zedd       Zedd       Zedd       Zedd       Zy)Uniquec                     t         j                  j                  ddgg d      } t        j                  g dt        j
                        }t        j                  |ddd      \  }}}}t        |||      \  }}}t        | |g||||gd	       y )
Nr   XYr   r   r   )inputsoutputs       @      ?r         @g      @r   r   Ttest_unique_sorted_without_axisr   r   name)	onnxhelper	make_noder	   r
   float32uniquer   r   node_sortedxyr   r   r   s         r   export_sorted_without_axisz!Unique.export_sorted_without_axis   s    kk++5A , 
 HH32::F.0ii4t.L+7OV+8_f,
(& 	3&92		
r   c            
     h   t         j                  j                  ddgg dd      } t        j                  g dt        j
                        }t        j                  |ddd      \  }}}}t        j                  |      }t        t        |t        j                  t        |                        }||   }t        j                  ||d	      }t        j                  |D cg c]  }||   	 c}t        j                        }||   }t        |||      \  }}}t!        | |g||||gd
       y c c}w )Nr   r   r   r   )r   r   sortedr   r   Taxis#test_unique_not_sorted_without_axisr   )r!   r"   r#   r	   r
   r$   r%   argsortdictziparangelentakeasarrayr   r   r   )	node_not_sortedr(   r)   r   r   r   argsorted_indicesinverse_indices_mapis	            r   export_not_sorted_without_axisz%Unique.export_not_sorted_without_axis*   s%   ++//5A	 0 
 HH32::F.0ii4t.L+7OV JJw/"!299S1B-C#DE
 +,GGAwQ'**-<= #=RXX
 )*+8_f,
(& 	3&96		
 >s   !D/c                 V   t         j                  j                  ddgg ddd      } t        j                  g dg dg dgt        j
                  	      }t        j                  |d
d
d
d      \  }}}}t        |||      \  }}}|j                         }t        | |g||||gd       y )Nr   r   r      r   r   r   r,   r.   r=   r   r   )         r   Tr-   test_unique_sorted_with_axisr   
r!   r"   r#   r	   r
   r$   r%   r   squeezer   r&   s         r   export_sorted_with_axiszUnique.export_sorted_with_axisW   s    kk++5A , 
 HHiI6bjjI.0ii4tRS.T+7OV+8_f,
(& *113 	3&9/		
r   c                 x   t         j                  j                  ddgg ddd      } t        j                  ddgddgddgddggddgddgddgddgggt        j
                  	      }t        j                  |d
d
d
d      \  }}}}t        |||      \  }}}|j                         }t        | |g||||gd       y )Nr   r   r   r=   r>   r   g        r   r   Tr-   test_unique_sorted_with_axis_3dr   rD   r&   s         r   export_sorted_with_axis_3dz!Unique.export_sorted_with_axis_3dy   s    kk++5A , 
 HHsc3Z#sc3Z@sc3Z#sc3Z@ **
 /1ii4tRS.T+7OV+8_f,
(& *113 	3&92		
r   c                 V   t         j                  j                  ddgg ddd      } t        j                  g dg dg dgt        j
                  	      }t        j                  |d
d
d
d      \  }}}}t        |||      \  }}}|j                         }t        | |g||||gd       y )Nr   r   r   r=   r>   r?   )r@   rA   rA   r   Tr-   %test_unique_sorted_with_negative_axisr   rD   r&   s         r    export_sorted_with_negative_axisz'Unique.export_sorted_with_negative_axis   s    kk++5A , 
 HHiI6bjjI.0ii4tRT.U+7OV+8_f,
(& *113 	3&98		
r   N)returnNone)	__name__
__module____qualname__staticmethodr*   r;   rF   rI   rM    r   r   r   r      sg    
 
& *
 *
X 
 
B (
 (
T  
  
r   r   )
__future__r   numpyr	   r!   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r   rT   r   r   <module>rY      s)    #   , .p
T p
r   