openvino icon indicating copy to clipboard operation
openvino copied to clipboard

[Feature Request] [Core] Add native ov::op::v17::atan2 to opset17

Open goyaladitya05 opened this issue 7 months ago • 2 comments

Request Description

Hi team ,

I'm Aditya Goyal. I've previously contributed to the Keras OpenVINO backend (#34017) and would like tocontribute directly to OpenVINO's opset. I've drafted a proposal for the atan2 op as a starting point.

atan2(y, x) is currently decomposed in the PyTorch, TensorFlow, and PaddlePaddle frontends via a shared translator in src/frontends/common_translators/src/op/atan2.cpp. The decomposition expands to ~40 nodes to correctly handle all IEEE 754 edge cases (quadrant selection, ±0, ±inf). A native op would:

  • Reduce the graph to 1 node
  • Delegate IEEE 754 correctness to std::atan2, which handles all edge cases natively
  • Enable plugin-level optimization (e.g. JIT emitters for x64/aarch64)

torch.atan2 and tf.math.atan2 both map to this. It is also present in ONNX's extended opset (com.microsoft::Atan2).

Note: atan2 was previously removed in PR #1184 (nGraph era). The codebase has been significantly restructured since then, and a native op fits into the current architecture.

I propose the following implementation:

  • ov::op::v17::Atan2 inheriting from util::BinaryElementwiseArithmetic (float-only: f16/bf16/f32/f64, numpy-style broadcast)
  • Reference kernel via std::atan2 in src/core/reference/
  • Registered in opset17_tbl.hpp
  • Template plugin evaluate() implementation
  • Simplification of the PyTorch, TensorFlow, and PaddlePaddle frontends from ~40 nodes to 1
  • Python bindings (opset17.atan2) and op spec documentation
  • com.microsoft::Atan2 ONNX contrib op mapping as a follow-up

I have the following questions:

  • Is atan2 okay as a starting point, or would you prefer a different operator?
  • Is a CPU JIT emitter expected as part of the same PR, or acceptable as a follow-up?

Feature Use Case

No response

Issue submission checklist

  • [x] The feature request or improvement must be related to OpenVINO

goyaladitya05 avatar Apr 09 '26 10:04 goyaladitya05

Hi @goyaladitya05 can i work on this issue ?

andersendsa avatar Apr 12 '26 04:04 andersendsa

Hi @goyaladitya05 can i work on this issue ?

No, I'm working on this.

goyaladitya05 avatar Apr 12 '26 08:04 goyaladitya05