Skip to content

[PT FE] support aten::kthvalue#31397

Merged
mvafin merged 4 commits into
openvinotoolkit:masterfrom
mahdi-jfri:frontend/pytorch/op/kthvalue
Sep 17, 2025
Merged

[PT FE] support aten::kthvalue#31397
mvafin merged 4 commits into
openvinotoolkit:masterfrom
mahdi-jfri:frontend/pytorch/op/kthvalue

Conversation

@mahdi-jfri
Copy link
Copy Markdown
Contributor

Details:

  • First apply TopK with sorted values, then gather the kth index.

Tickets:

@mahdi-jfri mahdi-jfri requested a review from a team as a code owner July 20, 2025 02:41
@mahdi-jfri mahdi-jfri requested review from PiotrKrzem and mvafin July 20, 2025 02:41
@github-actions github-actions Bot added the category: PyTorch FE OpenVINO PyTorch Frontend label Jul 20, 2025
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Jul 20, 2025
@mahdi-jfri mahdi-jfri force-pushed the frontend/pytorch/op/kthvalue branch from f6119b7 to ef28baa Compare July 20, 2025 03:08
@mahdi-jfri mahdi-jfri changed the title Added support for aten::kthvalue [PT FE] support aten::kthvalue Jul 20, 2025
@mahdi-jfri mahdi-jfri force-pushed the frontend/pytorch/op/kthvalue branch from ef28baa to d2fa2b3 Compare July 20, 2025 06:43
@mahdi-jfri
Copy link
Copy Markdown
Contributor Author

@mvafin @PiotrKrzem Hi! This has been awaiting a review for a while now. Any suggestions?

Comment thread tests/layer_tests/pytorch_tests/test_kthvalue.py
@mvafin mvafin requested a review from Copilot September 11, 2025 09:49
Comment thread src/frontends/pytorch/src/op/kthvalue.cpp Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the PyTorch aten::kthvalue operation by implementing translation logic that uses TopK with sorted values followed by gathering the kth index.

  • Implements translate_kthvalue function using TopK operation with MIN mode and value sorting
  • Adds comprehensive test coverage for various shapes, dimensions, and data types
  • Registers the new operation in the PyTorch frontend operation table

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/layer_tests/pytorch_tests/test_kthvalue.py Adds comprehensive test suite for kthvalue operation with parametrized test cases
src/frontends/pytorch/src/op_table.cpp Registers the translate_kthvalue function and maps aten::kthvalue operation
src/frontends/pytorch/src/op/kthvalue.cpp Implements the core translation logic using TopK and Gather operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/frontends/pytorch/src/op/kthvalue.cpp
Comment thread src/frontends/pytorch/src/op/kthvalue.cpp
Copy link
Copy Markdown
Contributor

@mvafin mvafin left a comment

Choose a reason for hiding this comment

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

Looks good

@mvafin
Copy link
Copy Markdown
Contributor

mvafin commented Sep 11, 2025

build_jenkins

@mvafin mvafin added this pull request to the merge queue Sep 17, 2025
Merged via the queue into openvinotoolkit:master with commit 85ca5fa Sep 17, 2025
203 checks passed
@mlukasze mlukasze added this to the 2025.4 milestone Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: PyTorch FE OpenVINO PyTorch Frontend ExternalPR External contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants