OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[Paddle FE] atan2: fix -pi/2 result for (x==0, y<0) (#37973)
HuEnwei9d770fe982ed
diff --git a/src/frontends/paddle/src/op/atan2.cpp b/src/frontends/paddle/src/op/atan2.cppindex aa07ea5d378..bc6878714eb 100644--- a/src/frontends/paddle/src/op/atan2.cpp+++ b/src/frontends/paddle/src/op/atan2.cpp@@ -71,7 +71,7 @@ NamedOutputs atan2(const NodeContext& node) {auto cond4 = make_shared<v1::LogicalAnd>(is_x_zero, is_y_negative);auto const_minus_two = create_same_type_const_scalar<int32_t>(x, -2);auto pi_div_minus_two = make_shared<v1::Divide>(const_pi, const_minus_two);- result = make_shared<v1::Select>(cond4, pi_div_two, result);+ result = make_shared<v1::Select>(cond4, pi_div_minus_two, result);NamedOutputs named_outputs;named_outputs["Out"] = {result};return named_outputs;diff --git a/src/frontends/paddle/tests/test_models/gen_scripts/generate_atan2.py b/src/frontends/paddle/tests/test_models/gen_scripts/generate_atan2.pyindex d52f89b6d71..dc55d30d3e4 100644--- a/src/frontends/paddle/tests/test_models/gen_scripts/generate_atan2.py+++ b/src/frontends/paddle/tests/test_models/gen_scripts/generate_atan2.py@@ -32,8 +32,10 @@ def atan2(name , x , y):def main():if paddle.__version__ >= '2.0.0':- input_x = np.array([-1, 1, 1, -1]).astype(np.float32)- input_y = np.array([-1, -1, 1, 1]).astype(np.float32)+ # issue 37831: add the x==0 quadrants; atan2(-1, 0) == -pi/2 (5th point) and+ # atan2(1, 0) == +pi/2 (6th point) were previously both mapped to +pi/2.+ input_x = np.array([-1, 1, 1, -1, -1, 1]).astype(np.float32)+ input_y = np.array([-1, -1, 1, 1, 0, 0]).astype(np.float32)atan2("atan2",input_x,input_y)if __name__ == "__main__":