:nosearch: .. _op_ai_onnx_GatherND-11: GatherND - version 11 ===================== This page documents version **11** of operator **GatherND**. See :doc:`GatherND` for the latest version (since version 13). - **Domain**: ``ai.onnx`` - **Since version**: 11 Given ``data`` tensor of rank ``r`` >= 1, and ``indices`` tensor of rank ``q`` >= 1, this operator gathers slices of ``data`` into an output tensor of rank ``q + r - indices_shape[-1] - 1``. ``indices`` is an q-dimensional integer tensor, best thought of as a ``(q-1)``-dimensional tensor of index-tuples into ``data``, where each element defines a slice of ``data`` Some salient points about the inputs' rank and shape: 1) r >= 1 and q >= 1 are to be honored. There is no dependency condition to be met between ranks ``r`` and ``q`` 2) The ``indices_shape[-1]`` should have a value between 1 (inclusive) and rank ``r`` (inclusive) 3) All values in ``indices`` are expected to be within bounds [-s, s-1] along axis of size ``s`` (i.e.) ``-data_shape[i] r`` => error condition 2) If ``indices_shape[-1] == r``, since the rank of ``indices`` is ``q``, ``indices`` can be thought of as a ``(q-1)``-dimensional tensor containing 1-D tensors of dimension ``r``. Let us think of each such ``r`` ranked tensor as ``indices_slice``. Each \*scalar value\* corresponding to ``data[indices_slice]`` is filled into the corresponding location of the ``(q-1)``-dimensional tensor to form the ``output`` tensor (Example 1 below) 3) If ``indices_shape[-1] < r``, since the rank of ``indices`` is ``q``, ``indices`` can be thought of as a ``(q-1)``-dimensional tensor containing 1-D tensors of dimension ``< r``. Let us think of each such tensors as ``indices_slice``. Each \*tensor slice\* corresponding to ``data[indices_slice , :]`` is filled into the corresponding location of the ``(q-1)``-dimensional tensor to form the ``output`` tensor (Examples 2, 3, and 4 below) This operator is the inverse of ``ScatterND``. ``Example 1`` .. code-block:: text data = [[0,1],[2,3]] # data_shape = [2, 2] indices = [[0,0],[1,1]] # indices_shape = [2, 2] output = [0,3] # output_shape = [2] ``Example 2`` .. code-block:: text data = [[0,1],[2,3]] # data_shape = [2, 2] indices = [[1],[0]] # indices_shape = [2, 1] output = [[2,3],[0,1]] # output_shape = [2, 2] ``Example 3`` .. code-block:: text data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] indices = [[0,1],[1,0]] # indices_shape = [2, 2] output = [[2,3],[4,5]] # output_shape = [2, 2] ``Example 4`` .. code-block:: text data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] indices = [[[0,1]],[[1,0]]] # indices_shape = [2, 1, 2] output = [[[2,3]],[[4,5]]] # output_shape = [2, 1, 2] **Inputs** - **data** (*T*): Tensor of rank r >= 1. - **indices** (*tensor(int64)*): Tensor of rank q >= 1. All index values are expected to be within bounds [-s, s-1] along axis of size s. It is an error if any of the index values are out of bounds. **Outputs** - **output** (*T*): Tensor of rank q + r - indices_shape[-1] - 1. **Type Constraints** - **T**: Constrain input and output types to any tensor type. Allowed types: tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).