Skip to content
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

Rad2deg #29352

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

Rad2deg #29352

wants to merge 7 commits into from

Conversation

leoheim
Copy link

@leoheim leoheim commented Mar 9, 2025

Details:

  • *Added support and test case files for aten::rad2deg *

Tickets:

@leoheim leoheim requested a review from a team as a code owner March 9, 2025 18:28
@leoheim leoheim requested review from slyalin and cavusmustafa March 9, 2025 18:28
@github-actions github-actions bot added the category: PyTorch FE OpenVINO PyTorch Frontend label Mar 9, 2025
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Mar 9, 2025
@mlukasze mlukasze linked an issue Mar 10, 2025 that may be closed by this pull request
@mlukasze mlukasze requested a review from mvafin March 10, 2025 05:47
@leoheim
Copy link
Author

leoheim commented Mar 17, 2025

Hi @rkazants ,

I hope you're doing well! Just wanted to follow up on my PR whenever you have a moment to review them. I’d appreciate any feedback or suggestions.

Thank you!

Copy link
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.

Please fix code style

@leoheim
Copy link
Author

leoheim commented Mar 19, 2025

Hi @mvafin,

I’ve made the requested changes. Let me know if there’s anything else needed!

@mvafin
Copy link
Contributor

mvafin commented Mar 24, 2025

Fix code style

src/frontends/pytorch/src/op/rad2deg.cpp:5:+#include <cmath>
src/frontends/pytorch/src/op/rad2deg.cpp:6:+
src/frontends/pytorch/src/op/rad2deg.cpp:6:-#include "openvino/op/multiply.hpp"
src/frontends/pytorch/src/op/rad2deg.cpp:8:-#include <cmath>
src/frontends/pytorch/src/op/rad2deg.cpp:9:+#include "openvino/op/multiply.hpp"
src/frontends/pytorch/src/op/rad2deg.cpp:18:-    
src/frontends/pytorch/src/op/rad2deg.cpp:19:+
src/frontends/pytorch/src/op/rad2deg.cpp:26:-    
src/frontends/pytorch/src/op/rad2deg.cpp:27:+
src/frontends/pytorch/src/op/rad2deg.cpp:29:-    
src/frontends/pytorch/src/op/rad2deg.cpp:30:+
src/frontends/pytorch/src/op_table.cpp:354:-

@leoheim
Copy link
Author

leoheim commented Mar 24, 2025

Hello @mvafin,

I’ve made the requested changes. Let me know if there’s anything else needed!

@mvafin
Copy link
Contributor

mvafin commented Mar 24, 2025

Code style still fails:

src/frontends/pytorch/src/op/rad2deg.cpp:8:-#include "openvino/op/multiply.hpp"
src/frontends/pytorch/src/op/rad2deg.cpp:9:+#include "openvino/op/multiply.hpp"
src/frontends/pytorch/src/op/rad2deg.cpp:19:-    
src/frontends/pytorch/src/op/rad2deg.cpp:19:+
src/frontends/pytorch/src/op/rad2deg.cpp:27:-    
src/frontends/pytorch/src/op/rad2deg.cpp:27:+
src/frontends/pytorch/src/op/rad2deg.cpp:30:-    
src/frontends/pytorch/src/op/rad2deg.cpp:30:+
src/frontends/pytorch/src/op_table.cpp:354:-

You can run clang-format to check for style issues

@leoheim
Copy link
Author

leoheim commented Mar 24, 2025

Hi @mvafin, I ran clang-format, and I think is correct now. Thanks for your time!

@leoheim
Copy link
Author

leoheim commented Mar 24, 2025

@mvafin Included now. Thanks!

@leoheim leoheim requested a review from mvafin March 24, 2025 16:16
@leoheim leoheim requested review from a team as code owners March 25, 2025 12:45
@leoheim leoheim requested review from itikhono and removed request for a team March 25, 2025 12:45
@github-actions github-actions bot added the category: transformations OpenVINO Runtime library - Transformations label Mar 25, 2025
@github-actions github-actions bot added the category: ONNX FE OpenVINO ONNX FrontEnd label Mar 25, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

@github-actions github-actions bot removed category: transformations OpenVINO Runtime library - Transformations category: ONNX FE OpenVINO ONNX FrontEnd labels Mar 25, 2025
@leoheim
Copy link
Author

leoheim commented Mar 25, 2025

Hi @mvafin, I apologize for the confusion. It seems I accidentally mixed changes from another branch into this one. I've corrected the issue now, and the branch should be clean. Thank you for pointing this out!

@mvafin
Copy link
Contributor

mvafin commented Mar 25, 2025

@leoheim Please add test. Seems like you removed it by accident

@leoheim
Copy link
Author

leoheim commented Mar 25, 2025

@mvafin I have added the test now. Apologies for the confusion earlier!

@leoheim leoheim requested a review from mvafin March 26, 2025 14:57
@leoheim
Copy link
Author

leoheim commented Mar 26, 2025

@mvafin
Thank you for the feedback! I have updated the test to use only one shape ((3, 3)) and added support for multiple data types (np.float32, np.float64, np.int32).

@leoheim
Copy link
Author

leoheim commented Mar 27, 2025

Hi @mvafin ,

I have updated the code as requested.

@mvafin
Copy link
Contributor

mvafin commented Mar 27, 2025

Please fix code style:

src/frontends/pytorch/src/op/rad2deg.cpp:9:-#include "openvino/op/multiply.hpp"
src/frontends/pytorch/src/op/rad2deg.cpp:10:+#include "openvino/op/multiply.hpp"
src/frontends/pytorch/src/op/rad2deg.cpp:31:-    auto conversion_factor_fp64 = context.mark_node(ov::op::v0::Constant::create(ov::element::f64, Shape{}, {180.0 / pi_val}));
src/frontends/pytorch/src/op/rad2deg.cpp:31:+    auto conversion_factor_fp64 =
src/frontends/pytorch/src/op/rad2deg.cpp:32:+        context.mark_node(ov::op::v0::Constant::create(ov::element::f64, Shape{}, {180.0 / pi_val}));
src/frontends/pytorch/src/op/rad2deg.cpp:34:-    auto conversion_factor = context.mark_node(std::make_shared<ov::op::v1::ConvertLike>(conversion_factor_fp64, input));
src/frontends/pytorch/src/op/rad2deg.cpp:35:+    auto conversion_factor =
src/frontends/pytorch/src/op/rad2deg.cpp:36:+        context.mark_node(std::make_shared<ov::op::v1::ConvertLike>(conversion_factor_fp64, input));

@leoheim leoheim requested a review from mvafin March 27, 2025 14:35
Comment on lines 32 to 33
auto conversion_factor =
context.mark_node(std::make_shared<ov::op::v1::ConvertLike>(conversion_factor_fp64, input));
Copy link
Contributor

Choose a reason for hiding this comment

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

Test for integer case fails due to type difference. Converting to input type is not correct for integer case. Use align_eltwise_input_types with input and conversion_factor_fp64, leave the constant fp64, but pass true as if the second input is python scalar, that way it will scale down to fp32 both input and scalar, not fp64.

@leoheim
Copy link
Author

leoheim commented Mar 28, 2025

@mvafin I have updated the code as requested. The constant remains as fp64, and I used align_eltwise_input_types with the input and the constant, passing true to handle integer cases correctly. Let me know if there's anything else to adjust. Thanks!

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.

[Good First Issue]: Support aten::rad2deg
4 participants