
    bIg                    R    d dl mZ d dlZd dlmZ 	 	 	 	 	 	 	 	 ddZ G d de      Zy)    )annotationsN)OpRunc                L   t        | j                        }g }d}t        |      D ]2  }|j                  |j                  |          ||j                  |   z  }4 |j                  d   ||z
  k(  r|t	        |j                        |d z   nC|t	        |j                        |d z   t	        | j                        ||j                  d   z   d  z   }g }|j                  |d|j                  d         }	| j                  |f| j                  |d  z         }
t        |	j                  d         D ]H  }t        |	j                  d         D ]+  }t        |	|   |         }|j                  |
|g|          - J t        j                  || j                        j                  |      fS )N   r   )dtype)
lenshaperangeappendlistreshapetuplenpasarrayr   )dataindices
batch_dims	data_rankbatch_dims_shapebatch_dims_sizeioutput_shapeoutput_data_bufferreshaped_indicesreshaped_data	batch_dim	outer_dimgather_indexs                 [/var/www/html/answerous/venv/lib/python3.12/site-packages/onnx/reference/ops/op_gathernd.py_gather_nd_implr!      s    DJJI  O : ,a 017==++, MM"Z!77 	4.z"==
w}}
j
,-
tzz
:b(99;
<=   GMM"<MN LL/!3djj6M!MNM +11!45 Q	/55a89 	QI !1)!<Y!GHL%%mY4N4N&OP	QQ JJ)<DD\RTT    c                      e Zd ZddZy)GatherNDNc                    t        |||      S N)r!   )selfr   r   r   s       r    _runzGatherND._run9   s    tWj99r"   r&   )__name__
__module____qualname__r(    r"   r    r$   r$   8   s    :r"   r$   )r   
np.ndarrayr   r-   r   intreturnztuple[np.ndarray])
__future__r   numpyr   onnx.reference.op_runr   r!   r$   r,   r"   r    <module>r3      sG    #  '*U
*U)*U7:*U*UZ:u :r"   