Skip to content

Added support for aten::percentFormat operator#33916

Open
Shekar-77 wants to merge 8 commits intoopenvinotoolkit:masterfrom
Shekar-77:master
Open

Added support for aten::percentFormat operator#33916
Shekar-77 wants to merge 8 commits intoopenvinotoolkit:masterfrom
Shekar-77:master

Conversation

@Shekar-77
Copy link

Fixes issue: #29708
Parent issue: #28584

@Shekar-77 Shekar-77 requested review from a team as code owners January 31, 2026 19:51
@github-actions github-actions bot added category: Python API OpenVINO Python bindings category: PyTorch FE OpenVINO PyTorch Frontend labels Jan 31, 2026
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Jan 31, 2026
@mlukasze mlukasze linked an issue Feb 2, 2026 that may be closed by this pull request
@Shekar-77 Shekar-77 requested review from a team as code owners February 7, 2026 19:39
@Shekar-77 Shekar-77 requested review from mlukasze and zKulesza and removed request for a team February 7, 2026 19:39
@github-actions github-actions bot removed category: CI OpenVINO public CI category: docs OpenVINO documentation category: ONNX FE OpenVINO ONNX FrontEnd category: dependency_changes Pull requests that update a dependency file category: AUTO OpenVINO AUTO device selection plugin category: TF FE OpenVINO TensorFlow FrontEnd github_actions Pull requests that update GitHub Actions code no-match-files category: NPU OpenVINO NPU plugin category: dockerfiles category: JAX FE OpenVINO JAX FrontEnd category: OVC OVC tool labels Feb 7, 2026
@Shekar-77
Copy link
Author

Hello @mmikolajcz @PiotrekCzajkowski @mlukasze could you please approve the pr for review. Am a gsoc 2026 contributer, was asked to make contributions before the application period starts. Thank you for your time.

@mlukasze mlukasze removed request for a team February 25, 2026 08:43
Copy link
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 aten::percentFormat operator in the PyTorch frontend. The implementation extracts the numeric value from a format string operation by returning the input tensor directly, since the OpenVINO IR cannot represent string formatting operations.

Changes:

  • Added translation handler for aten::percentFormat operator that returns the input tensor
  • Registered the operator in the supported operations table
  • Added test coverage with parametrized format strings

Reviewed changes

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

File Description
tests/layer_tests/pytorch_tests/test_percent_format.py New test file with parametrized tests for different format string patterns
src/frontends/pytorch/src/op_table.cpp Registered translate_percent_format converter and added op table entry
src/frontends/pytorch/src/op/percent_format.cpp Implementation of the percent format operator translator
src/bindings/python/thirdparty/pybind11 Updated pybind11 submodule commit hash

Comment on lines +25 to +29
@pytest.mark.parametrize("format_str", [
"%.2f%%",
"%f%%",
"%.0f%%"
])
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The format_str parameter is defined but never used in the test. The create_model method accepts format_str but hardcodes the format string on line 20. Either remove the parameter or update the model to use it.

Copilot uses AI. Check for mistakes.
def _test(self, *args, **kwargs):
# Since our C++ translator returns a float but PyTorch returns a string,
# we skip the result comparison and just verify the conversion succeeds.
kwargs["custom_eps"] = 1e18
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The custom_eps value of 1e18 is extremely large and deserves a comment explaining why such a large epsilon is necessary for skipping result comparison.

Suggested change
kwargs["custom_eps"] = 1e18
kwargs["custom_eps"] = 1e18 # Use an extremely large epsilon to effectively disable numeric result comparison.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +24
}
}
}
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Inconsistent spacing in closing braces. Lines 21, 23, and 24 have trailing spaces while line 22 does not. Remove trailing spaces for consistency.

Suggested change
}
}
}
}
}
}
}
}

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +19
OutputVector translate_percent_format(const NodeContext& context) {

if (context.get_input_size() < 2) {
return {context.get_input(0)};
}
return {context.get_input(1)};
};
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The logic for choosing between input(0) and input(1) based on input_size is not documented. Add a comment explaining why input(1) is returned when there are 2+ inputs and what these inputs represent.

Copilot uses AI. Check for mistakes.
@Shekar-77
Copy link
Author

@mlukasze I have made the required changes, could you please approve for review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings category: Python API OpenVINO Python bindings category: PyTorch FE OpenVINO PyTorch Frontend ExternalPR External contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Good First Issue]: Support aten::percentFormat

4 participants