Skip to content

[Good First Issue][Keras 3 OpenVINO Backend]: Support nanargmax and nanargmin operations #34557

@goyaladitya05

Description

@goyaladitya05

Context

🚀 A great opportunity to contribute to two popular AI projects with just one PR: Keras 3 and OpenVINO.

Keras 3 enables seamless switching between supported backends—PyTorch, TensorFlow, and JAX. Since Keras 3.8.0, the OpenVINO backend allows developers to leverage OpenVINO for model predictions directly within Keras 3 workflows. Currently, the OpenVINO backend lacks support for some operations. Our goal is to resolve this gap and to optimize it for inference on Intel devices by supporting as many models as possible while delivering optimal performance.

What needs to be done?

Implement nanargmax and nanargmin in the OpenVINO backend. These operations return the indices of the maximum and minimum values, while ignoring NaN values. The operations should be implemented in keras/src/backend/openvino/numpy.py and must align with NumPy-equivalent behavior.

Steps to Contribute

First use .take to get the issue assigned to you.
Since this involves cross-repo work between Keras and OpenVINO, please follow these steps carefully:

  1. Set up your developer environment:

    • Fork and clone the Keras repository.
    • Install the requirements:
      pip install -r requirements.txt .
  2. Implement the operation:

    • Provide the decomposition in Python for the targeted operation in keras/src/backend/openvino/numpy.py.
    • Use the OpenVINO Operation Set for the implementation.
  3. Enable and verify tests:

    • Remove the line corresponding to the implemented operation from the excluded_concrete_tests.txt file (located in the OpenVINO backend directory).
    • Create a pytest.ini file in the root directory of your cloned repository with the following content to set the backend:
      [pytest]
      env =
          KERAS_BACKEND=openvino
    • Run the tests to ensure everything is passing:
      pytest -c ./pytest.ini ./keras/src/ops/numpy_test.py
  4. Submit your PR:

    • Commit your changes and create a Pull Request in the Keras repository.
    • Mention @rkazants in the PR description for review.

Example Pull Requests

Resources

Contact points

@rkazants

AI notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Ticket

#34017

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Contributors Needed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions