
    h                         S SK rS SKJr  S\R                  S\R                  S\R                  4S jrS\R                  S\S\R                  S\R                  4S jr " S	 S
\5      rg)    N)OpRunselfindexreturnc                     / n[        X5       H  u  p4UR                  X4S      5        M     [        R                  " X R                  S9R                  UR                  5      $ )Nr   dtype)zipappendnparrayr	   reshapeshape)r   r   resabs        _/var/www/fran/franai/venv/lib/python3.13/site-packages/onnx/reference/ops/op_gather_elements.pygather_numpy_2r      sL    
CD 

1qT7 !88Czz*225;;??    dimc                    UR                   S U UR                   US-   S  -   nU R                   S U U R                   US-   S  -   nX4:w  a  [        SU< S35      e[        R                  " U SU5      n[        R                  " USU5      n [        R                  " XeSS9n[        R                  " USU5      $ ! [         aI  n[        UR                   5      S:X  a)  [        UR                   5      S:X  a  [        X5      s S nA$ UeS nAff = f)N   zExcept for dimension z;, all dimensions of index and self should be the same size.r   wrap)mode   )r   
ValueErrorr   swapaxeschooselenr   )	r   r   r   idx_xsection_shapeself_xsection_shapedata_swapedindex_swapedgatheredes	            r   gather_numpyr&      s   Tc*U[[q-CC**Tc*TZZa	-BB0#C7 +6 7
 	
 ++dAs+K;;ua-L99\VD ;;xC((  |!!"a'C0A0A,Ba,G!$..s$   B8 8
D<D>DDDc                       \ rS rSrSS jrSrg)GatherElements'   Nc                     UR                   S:X  a   [        R                  " SUR                  S94$  [	        XU5      4$ ! [
         a#    [	        XUR                  [        5      5      4s $ f = f)Nr   )r   r   )sizer   emptyr	   r&   	TypeErrorastypeint)r   dataindicesaxiss       r   _runGatherElements._run(   sf    <<1HHT466	D W577 	D W^^C-@ACC	Ds   ? *A,+A, )N)__name__
__module____qualname____firstlineno__r3   __static_attributes__r5   r   r   r(   r(   '   s    Dr   r(   )	numpyr   onnx.reference.op_runr   ndarrayr   r/   r&   r(   r5   r   r   <module>r>      sr     '@ @BJJ @2:: @)rzz ) )BJJ )2:: )*DU Dr   