Skip to content

[CPU][REF][GatherND]: Support negative indices. #30764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

pkowalc1
Copy link
Contributor

@pkowalc1 pkowalc1 commented May 28, 2025

Details:

  • added more tests for ref impl
  • cpu plugin's gather ND supports negtive indices
  • added test with negative indices for cpu plugin
  • updated GatherND spec

Tickets:

@pkowalc1 pkowalc1 requested a review from a team as a code owner May 28, 2025 09:20
@pkowalc1 pkowalc1 added the WIP work in progress label May 28, 2025
@github-actions github-actions bot added the category: TEMPLATE OpenVINO Template plugin label May 28, 2025
@pkowalc1 pkowalc1 requested review from a team as code owners May 29, 2025 07:12
@github-actions github-actions bot added category: IE Tests OpenVINO Test: plugins and common category: CPU OpenVINO CPU plugin labels May 29, 2025
@pkowalc1 pkowalc1 requested a review from a team as a code owner May 29, 2025 07:16
@pkowalc1 pkowalc1 requested review from kblaszczak-intel and removed request for a team May 29, 2025 07:16
@github-actions github-actions bot added the category: docs OpenVINO documentation label May 29, 2025
@pkowalc1 pkowalc1 changed the title WIP: [GatherND]: Support negative indicies [GatherND]: Support negative indicies for ref and CPU plugin impl. May 30, 2025
@pkowalc1 pkowalc1 removed the WIP work in progress label May 30, 2025
@praasz praasz added this to the 2025.3 milestone Jun 4, 2025
@pkowalc1 pkowalc1 changed the title [GatherND]: Support negative indicies for ref and CPU plugin impl. [CPU][REF][GatherND]: Support negative indicies for ref and CPU plugin impl. Jun 4, 2025
@pkowalc1 pkowalc1 changed the title [CPU][REF][GatherND]: Support negative indicies for ref and CPU plugin impl. [CPU][REF][GatherND]: Support negative indicies. Jun 4, 2025
@pkowalc1 pkowalc1 changed the title [CPU][REF][GatherND]: Support negative indicies. [CPU][REF][GatherND]: Support negative indices. Jun 5, 2025
Copy link
Contributor

@mitruska mitruska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This PR introduces support for negative indices in GatherND-8, it is a small backward compatible change, so it has been decided to introduce it within the same op version.

@@ -47,7 +47,7 @@ if ``indices.shape[-1] == data.rank - batch_dims``, else

* **1**: ``data`` tensor of type *T*. A tensor of a rank not less than 1. **Required.**
* **2**: ``indices`` tensor of type *T_IND*. A tensor of a rank not less than 1.
It requires all indices from this tensor to be in the range ``[0, s-1]`` where ``s`` is the corresponding dimension to
It requires all indices from this tensor to be in the range ``[-s, s-1]`` where ``s`` is the corresponding dimension to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional within this PR, can be discussed/reviewed separately)

As it is an update of behavior within the same op version (GatherND-8), it would be good to add a note with the release version of the change like:

.. note::

    Behavior before 2025.3 OpenVINO release: Negative indices were not supported.

Example of similar note for Squeeze-1 #25488,
https://docs.openvino.ai/2025/documentation/openvino-ir-format/operation-sets/operation-specs/shape/squeeze-1.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: CPU OpenVINO CPU plugin category: docs OpenVINO documentation category: IE Tests OpenVINO Test: plugins and common category: TEMPLATE OpenVINO Template plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants