
    wi                    J    d dl mZ d dlZd dlmZ ddZ G d de          ZdS )    )annotationsN)OpRundata
np.ndarrayindices
batch_dimsintreturntuple[np.ndarray]c                   t          | j                  }g }d}t          |          D ]2}|                    |j        |                    ||j        |         z  }3|j        d         ||z
  k    r|t	          |j                  |d         z   nI|t	          |j                  |d         z   t	          | j                  ||j        d         z   d          z   }g }|                    |d|j        d                   }	|                     |g| j        |d          R           }
t          |	j        d                   D ]Y}t          |	j        d                   D ]<}t          |	|         |                   }|                    |
|g|R                     =Zt          j        || j	                                      |          fS )N   r   )dtype)
lenshaperangeappendlistreshapetuplenpasarrayr   )r   r   r   	data_rankbatch_dims_shapebatch_dims_sizeioutput_shapeoutput_data_bufferreshaped_indicesreshaped_data	batch_dim	outer_dimgather_indexs                 n/root/.openclaw/workspace/chatterbox_venv_py311/lib/python3.11/site-packages/onnx/reference/ops/op_gathernd.py_gather_nd_implr%      s    DJI  O : , ,a 01117=++ M"Z!777 	4..z"}===
w}

jm
,-
tz

:b(99;;
<=   GM"<MNN LL/!LDJz{{4K!L!LMMM +1!455 Q Q	/5a899 	Q 	QI !1)!<Y!GHHL%%mY4N4N4N&OPPPP	Q J)<<<DD\RRTT    c                      e Zd ZddZdS )GatherNDNc                $    t          |||          S N)r%   )selfr   r   r   s       r$   _runzGatherND._run9   s    tWj999r&   r*   )__name__
__module____qualname__r,    r&   r$   r(   r(   8   s(        : : : : : :r&   r(   )r   r   r   r   r   r	   r
   r   )
__future__r   numpyr   onnx.reference.op_runr   r%   r(   r0   r&   r$   <module>r4      s    # " " " " "     ' ' ' ' ' '*U *U *U *UZ: : : : :u : : : : :r&   