From 20f6df364d187295c5fdb4388a65bf3def44c3a6 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:01:57 +0530 Subject: [PATCH 01/42] Create angle.cpp --- src/frontends/tensorflow/src/op/angle.cpp | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/frontends/tensorflow/src/op/angle.cpp diff --git a/src/frontends/tensorflow/src/op/angle.cpp b/src/frontends/tensorflow/src/op/angle.cpp new file mode 100644 index 00000000000000..8b137891791fe9 --- /dev/null +++ b/src/frontends/tensorflow/src/op/angle.cpp @@ -0,0 +1 @@ + From 4661cda3cf2c07b300afdb9146e56417becde110 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:16:42 +0530 Subject: [PATCH 02/42] Create angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/frontends/tensorflow_common/src/op/angle.cpp diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp new file mode 100644 index 00000000000000..8b137891791fe9 --- /dev/null +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -0,0 +1 @@ + From 24836351e861e6fd5d17e0c929b58cc38b0ff338 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:17:12 +0530 Subject: [PATCH 03/42] Update angle.cpp --- .../tensorflow_common/src/op/angle.cpp | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 8b137891791fe9..29e1572e03e420 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -1 +1,86 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +#include "common_op_table.hpp" +#include "helper_ops/complex_type_mark.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/atan.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/convert_like.hpp" +#include "openvino/op/divide.hpp" +#include "openvino/op/equal.hpp" +#include "openvino/op/greater.hpp" +#include "openvino/op/greater_eq.hpp" +#include "openvino/op/less.hpp" +#include "openvino/op/logical_and.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/select.hpp" +#include "openvino/op/subtract.hpp" + +using namespace std; +using namespace ov::op; + +namespace ov { +namespace frontend { +namespace tensorflow { +namespace op { + +OutputVector translate_atan2_op(const NodeContext& node) { + default_op_checks(node, 2, {"Atan2"}); + auto complex = node.get_input(0); + + auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); + if (complex_type_mark) { + element::Type complex_part_type = complex_type_mark->get_complex_part_type(); + auto coomplex = complex_type_mark->input_value(0); + + auto real_index = make_shared(element::i32, Shape{1}, 0); + auto imag_index = make_shared(element::i32, Shape{1}, 1); + + auto gather_axis = make_shared(element::i32, Shape{1}, -1); + + auto x = make_shared(x, real_index, gather_axis)->output(0); + auto y = make_shared(x, imag_index, gather_axis)->output(0); + + + // handle the first condition : x>0 + auto div_y_x = make_shared(y, x); + auto atan = make_shared(div_y_x); + auto const_zero = create_same_type_const_scalar(x, 0); + auto result = atan->output(0); + + // handle the second condition : x<0 && y>=0 + auto const_pi = create_same_type_const_scalar(x, std::atan(1.0) * 4); + auto is_x_negative = make_shared(x, const_zero); + auto y_non_negative = make_shared(y, const_zero); + auto cond1 = make_shared(is_x_negative, y_non_negative); + auto atan_y_x_plus_pi = make_shared(atan, const_pi); + result = make_shared(cond1, atan_y_x_plus_pi, result); + + // handle the third condition : x<0 && y<0 + auto is_y_negative = make_shared(y, const_zero); + auto cond2 = make_shared(is_x_negative, is_y_negative); + auto atan_y_x_minus_pi = make_shared(atan, const_pi); + result = make_shared(cond2, atan_y_x_minus_pi, result); + + // handle the fourth condition : x=0 && y>0 + auto is_x_zero = make_shared(x, const_zero); + auto is_y_positive = make_shared(y, const_zero); + auto cond3 = make_shared(is_x_zero, is_y_positive); + auto const_two = create_same_type_const_scalar(x, 2); + auto pi_div_two = make_shared(const_pi, const_two); + result = make_shared(cond3, pi_div_two, result); + + // handle the fifth condition : x=0 && y<0 + auto cond4 = make_shared(is_x_zero, is_y_negative); + auto const_minus_two = create_same_type_const_scalar(x, -2); + auto pi_div_minus_two = make_shared(const_pi, const_minus_two); + result = make_shared(cond4, pi_div_two, result); + + set_node_name(node.get_name(), result.get_node_shared_ptr()); + return {result}; +} +} // namespace op +} // namespace tensorflow +} // namespace frontend +} // namespace ov From 3dc3593f26417e2235c0edb9f6a9dc72f54289f5 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:20:03 +0530 Subject: [PATCH 04/42] Update common_op_table.hpp --- src/frontends/tensorflow_common/include/common_op_table.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontends/tensorflow_common/include/common_op_table.hpp b/src/frontends/tensorflow_common/include/common_op_table.hpp index 9a4376951c14cf..51a582a4783ebb 100644 --- a/src/frontends/tensorflow_common/include/common_op_table.hpp +++ b/src/frontends/tensorflow_common/include/common_op_table.hpp @@ -34,6 +34,7 @@ OP_T_CONVERTER(translate_direct_reduce_op); OP_CONVERTER(translate_add_n_op); OP_CONVERTER(translate_adjust_contrast_op); +OP_CONVERTER(translate_angle_op); OP_CONVERTER(translate_arg_max_op); OP_CONVERTER(translate_arg_min_op); OP_CONVERTER(translate_atan2_op); From 695fb8ecbf91b13abad47dfbbf4997ce72258fec Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:57:40 +0530 Subject: [PATCH 05/42] Update op_table.cpp --- src/frontends/tensorflow/src/op_table.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontends/tensorflow/src/op_table.cpp b/src/frontends/tensorflow/src/op_table.cpp index 034861ba6030a5..0b5bd3f82e8851 100644 --- a/src/frontends/tensorflow/src/op_table.cpp +++ b/src/frontends/tensorflow/src/op_table.cpp @@ -205,6 +205,7 @@ const std::map get_supported_ops() { // Separate translators: {"AddN", CreatorFunction(translate_add_n_op)}, {"AdjustContrastv2", CreatorFunction(translate_adjust_contrast_op)}, + {"Angle", CreatorFunction(translate_angle_op)}, {"ArgMax", CreatorFunction(translate_arg_max_op)}, {"ArgMin", CreatorFunction(translate_arg_min_op)}, {"Assert", CreatorFunction(translate_no_op)}, From b88a94a9c9f5d7dd9f4c9f853ee25e77a7a1fc17 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 22:05:51 +0530 Subject: [PATCH 06/42] Create test_angle.py --- tests/layer_tests/tensorflow_tests/test_angle.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/layer_tests/tensorflow_tests/test_angle.py diff --git a/tests/layer_tests/tensorflow_tests/test_angle.py b/tests/layer_tests/tensorflow_tests/test_angle.py new file mode 100644 index 00000000000000..8b137891791fe9 --- /dev/null +++ b/tests/layer_tests/tensorflow_tests/test_angle.py @@ -0,0 +1 @@ + From 3293efef5578a6b2ed12c576073ef474739baeb5 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 22:07:31 +0530 Subject: [PATCH 07/42] Update and rename test_angle.py to test_tf_angle.py --- .../tensorflow_tests/test_angle.py | 1 - .../tensorflow_tests/test_tf_angle.py | 46 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) delete mode 100644 tests/layer_tests/tensorflow_tests/test_angle.py create mode 100644 tests/layer_tests/tensorflow_tests/test_tf_angle.py diff --git a/tests/layer_tests/tensorflow_tests/test_angle.py b/tests/layer_tests/tensorflow_tests/test_angle.py deleted file mode 100644 index 8b137891791fe9..00000000000000 --- a/tests/layer_tests/tensorflow_tests/test_angle.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py new file mode 100644 index 00000000000000..4c5ed9e3a3bded --- /dev/null +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -0,0 +1,46 @@ +# Copyright (C) 2018-2023 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import numpy as np +import pytest +import tensorflow as tf +from common.tf_layer_test_class import CommonTFLayerTest + + +class TestAtan2(CommonTFLayerTest): + def _prepare_input(self, inputs_info): + assert 'y' in inputs_info + assert 'x' in inputs_info + y_shape = inputs_info['y'] + x_shape = inputs_info['x'] + inputs_data = {} + inputs_data['y'] = np.random.rand(*y_shape).astype(self.input_type) - np.random.rand(*y_shape).astype(self.input_type) + inputs_data['x'] = np.random.rand(*x_shape).astype(self.input_type) - np.random.rand(*x_shape).astype(self.input_type) + return inputs_data + + def create_atan2_net(self, input_shape, input_type): + self.input_type = input_type + tf.compat.v1.reset_default_graph() + # Create the graph and model + with tf.compat.v1.Session() as sess: + y = tf.compat.v1.placeholder(input_type, input_shape, 'y') + x = tf.compat.v1.placeholder(input_type, input_shape, 'x') + tf.raw_ops.Atan2(y=y, x=x) + tf.compat.v1.global_variables_initializer() + tf_net = sess.graph_def + + return tf_net, None + + test_data_basic = [ + dict(input_shape=[1, 2], input_type=np.float32), + dict(input_shape=[2, 3, 4], input_type=np.float32), + ] + + @pytest.mark.parametrize("params", test_data_basic) + @pytest.mark.precommit_tf_fe + @pytest.mark.nightly + def test_atan2_basic(self, params, ie_device, precision, ir_version, temp_dir, + use_new_frontend, use_old_api): + self._test(*self.create_atan2_net(**params), + ie_device, precision, ir_version, temp_dir=temp_dir, + use_new_frontend=use_new_frontend, use_old_api=use_old_api) From c33984d32770f31358c599546970cc879523a144 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 22:30:53 +0530 Subject: [PATCH 08/42] Delete src/frontends/tensorflow/src/op/angle.cpp --- src/frontends/tensorflow/src/op/angle.cpp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/frontends/tensorflow/src/op/angle.cpp diff --git a/src/frontends/tensorflow/src/op/angle.cpp b/src/frontends/tensorflow/src/op/angle.cpp deleted file mode 100644 index 8b137891791fe9..00000000000000 --- a/src/frontends/tensorflow/src/op/angle.cpp +++ /dev/null @@ -1 +0,0 @@ - From 44fa3984e546362158575e31d84f68768ebc7929 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 22:40:57 +0530 Subject: [PATCH 09/42] Update angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 29e1572e03e420..5dd2274498cb49 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -25,8 +25,8 @@ namespace frontend { namespace tensorflow { namespace op { -OutputVector translate_atan2_op(const NodeContext& node) { - default_op_checks(node, 2, {"Atan2"}); +OutputVector translate_angle_op(const NodeContext& node) { + default_op_checks(node, 1, {"Angle"}); auto complex = node.get_input(0); auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); From bf10096ad3655f4ecb5140a275e16dc17405c97e Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 22 Feb 2024 22:54:58 +0530 Subject: [PATCH 10/42] Update supported_ops.md --- src/frontends/tensorflow/docs/supported_ops.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow/docs/supported_ops.md b/src/frontends/tensorflow/docs/supported_ops.md index 94956372a0bd94..50e4face2c0167 100644 --- a/src/frontends/tensorflow/docs/supported_ops.md +++ b/src/frontends/tensorflow/docs/supported_ops.md @@ -26,7 +26,7 @@ A "supported operation" is one that TensorFlow Frontend can convert to the OpenV | All | YES | | | AllCandidateSampler | NO | | | AllToAll | NO | | -| Angle | NO | | +| Angle | YES | | | AnonymousHashTable | NO | | | AnonymousIterator | NO | | | AnonymousIteratorV2 | NO | | From 28fcad91a757e0f4d34c710e9814fb2416913e26 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sat, 24 Feb 2024 23:47:33 +0400 Subject: [PATCH 11/42] Update tests/layer_tests/tensorflow_tests/test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index 4c5ed9e3a3bded..63ebd4ff2e0e4f 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -7,7 +7,7 @@ from common.tf_layer_test_class import CommonTFLayerTest -class TestAtan2(CommonTFLayerTest): +class TestAngle(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'y' in inputs_info assert 'x' in inputs_info From 8f9caf11fafc9896c5c77d4b45cb01305c2fc38b Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sat, 24 Feb 2024 23:47:42 +0400 Subject: [PATCH 12/42] Update tests/layer_tests/tensorflow_tests/test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index 63ebd4ff2e0e4f..58f264481cbb8f 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -18,7 +18,7 @@ def _prepare_input(self, inputs_info): inputs_data['x'] = np.random.rand(*x_shape).astype(self.input_type) - np.random.rand(*x_shape).astype(self.input_type) return inputs_data - def create_atan2_net(self, input_shape, input_type): + def create_angle_net(self, input_shape, input_type): self.input_type = input_type tf.compat.v1.reset_default_graph() # Create the graph and model From 0a062acfa09cd3fcab33f207757c9df4c46683a9 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sat, 24 Feb 2024 23:47:50 +0400 Subject: [PATCH 13/42] Update tests/layer_tests/tensorflow_tests/test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index 58f264481cbb8f..d70b414730b675 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -39,7 +39,7 @@ def create_angle_net(self, input_shape, input_type): @pytest.mark.parametrize("params", test_data_basic) @pytest.mark.precommit_tf_fe @pytest.mark.nightly - def test_atan2_basic(self, params, ie_device, precision, ir_version, temp_dir, + def test_angle(self, params, ie_device, precision, ir_version, temp_dir, use_new_frontend, use_old_api): self._test(*self.create_atan2_net(**params), ie_device, precision, ir_version, temp_dir=temp_dir, From 42a2aeed4120e88ab6cb6a2b2699763d84028455 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sat, 24 Feb 2024 23:47:59 +0400 Subject: [PATCH 14/42] Update tests/layer_tests/tensorflow_tests/test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index d70b414730b675..d859b0e5de655b 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -41,6 +41,6 @@ def create_angle_net(self, input_shape, input_type): @pytest.mark.nightly def test_angle(self, params, ie_device, precision, ir_version, temp_dir, use_new_frontend, use_old_api): - self._test(*self.create_atan2_net(**params), + self._test(*self.create_angle_net(**params), ie_device, precision, ir_version, temp_dir=temp_dir, use_new_frontend=use_new_frontend, use_old_api=use_old_api) From 2063766dc9685a3b74021cd459db1e711e083ba4 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sat, 24 Feb 2024 23:48:09 +0400 Subject: [PATCH 15/42] Update src/frontends/tensorflow_common/src/op/angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 5dd2274498cb49..a24ea04877fe07 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -26,7 +26,7 @@ namespace tensorflow { namespace op { OutputVector translate_angle_op(const NodeContext& node) { - default_op_checks(node, 1, {"Angle"}); + default_op_checks(node, 1, {"Angle"}, true); auto complex = node.get_input(0); auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); From d01db7cd6ae9ed549bcd05f8cd69663fb15e80aa Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sun, 25 Feb 2024 17:03:07 +0400 Subject: [PATCH 16/42] Update src/frontends/tensorflow_common/src/op/angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index a24ea04877fe07..56801f0023d652 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 #include "common_op_table.hpp" From da7621d7a8b994afff4319dd8610902e66c6533c Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sun, 25 Feb 2024 17:03:12 +0400 Subject: [PATCH 17/42] Update tests/layer_tests/tensorflow_tests/test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index d859b0e5de655b..ed69d8fea3b817 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np From 40f4b32320f5e140efeda7151cd2c912da94d0fd Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:07:52 +0530 Subject: [PATCH 18/42] Update angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 56801f0023d652..5d5785ed1afabb 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -40,7 +40,7 @@ OutputVector translate_angle_op(const NodeContext& node) { auto gather_axis = make_shared(element::i32, Shape{1}, -1); auto x = make_shared(x, real_index, gather_axis)->output(0); - auto y = make_shared(x, imag_index, gather_axis)->output(0); + auto y = make_shared(x, imag_index, gather_axis)->output(0);} // handle the first condition : x>0 From 9fc48fdb15260fd3cb476e1a981d7f32229ded8d Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 29 Feb 2024 07:25:47 +0530 Subject: [PATCH 19/42] Update test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index ed69d8fea3b817..f3e0d5606b8343 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -25,7 +25,8 @@ def create_angle_net(self, input_shape, input_type): with tf.compat.v1.Session() as sess: y = tf.compat.v1.placeholder(input_type, input_shape, 'y') x = tf.compat.v1.placeholder(input_type, input_shape, 'x') - tf.raw_ops.Atan2(y=y, x=x) + complex = tf.raw_ops.complex(real = x,imag =y) + tf.raw_ops.Angle(input = x) tf.compat.v1.global_variables_initializer() tf_net = sess.graph_def From 34accfe30c097d0d0943b3da1e62b1da40c19978 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Thu, 29 Feb 2024 20:15:10 +0530 Subject: [PATCH 20/42] Update angle.cpp --- .../tensorflow_common/src/op/angle.cpp | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 5d5785ed1afabb..e2170848964c57 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -30,17 +30,22 @@ OutputVector translate_angle_op(const NodeContext& node) { auto complex = node.get_input(0); auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); - if (complex_type_mark) { - element::Type complex_part_type = complex_type_mark->get_complex_part_type(); - auto coomplex = complex_type_mark->input_value(0); + element::Type complex_part_type = complex_type_mark->get_complex_part_type(); + auto op_type = node.get_op_type() + auto coomplex = complex_type_mark->input_value(0); - auto real_index = make_shared(element::i32, Shape{1}, 0); - auto imag_index = make_shared(element::i32, Shape{1}, 1); + TENSORFLOW_OP_VALIDATION( + node, + complex_type_mark, + "[TENSORFLOW FRONTEND] Internal error: complex_type_mark does not support" + op_type + "operation" + ); - auto gather_axis = make_shared(element::i32, Shape{1}, -1); + auto real_index = make_shared(element::i32, Shape{1}, 0); + auto imag_index = make_shared(element::i32, Shape{1}, 1); + auto gather_axis = make_shared(element::i32, Shape{1}, -1); - auto x = make_shared(x, real_index, gather_axis)->output(0); - auto y = make_shared(x, imag_index, gather_axis)->output(0);} + auto x = make_shared(x, real_index, gather_axis)->output(0); + auto y = make_shared(x, imag_index, gather_axis)->output(0); // handle the first condition : x>0 From 7dae5d759bcdb84fc937f203e9ce8c7f94eb2ceb Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:53:17 +0530 Subject: [PATCH 21/42] Update src/frontends/tensorflow_common/src/op/angle.cpp Co-authored-by: Roman Kazantsev --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index e2170848964c57..473e95c73a1487 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -37,7 +37,7 @@ OutputVector translate_angle_op(const NodeContext& node) { TENSORFLOW_OP_VALIDATION( node, complex_type_mark, - "[TENSORFLOW FRONTEND] Internal error: complex_type_mark does not support" + op_type + "operation" + "[TensorFlow Frontend] inconsistent model: Angle operation expects complex type tensor on input" ); auto real_index = make_shared(element::i32, Shape{1}, 0); From e21e8f7243f6330f8b1ee3a2c84ad39f83bdb33b Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:53:38 +0530 Subject: [PATCH 22/42] Update src/frontends/tensorflow_common/src/op/angle.cpp Co-authored-by: Roman Kazantsev --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 473e95c73a1487..c6d5b720286c8e 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -32,7 +32,7 @@ OutputVector translate_angle_op(const NodeContext& node) { auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); element::Type complex_part_type = complex_type_mark->get_complex_part_type(); auto op_type = node.get_op_type() - auto coomplex = complex_type_mark->input_value(0); + complex = complex_type_mark->input_value(0); TENSORFLOW_OP_VALIDATION( node, From 4d41fcfc8f92028a05804aa1b46e6c92f3db2105 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:54:01 +0530 Subject: [PATCH 23/42] Update src/frontends/tensorflow_common/src/op/angle.cpp Co-authored-by: Roman Kazantsev --- src/frontends/tensorflow_common/src/op/angle.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index c6d5b720286c8e..b111a407455918 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -31,7 +31,6 @@ OutputVector translate_angle_op(const NodeContext& node) { auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); element::Type complex_part_type = complex_type_mark->get_complex_part_type(); - auto op_type = node.get_op_type() complex = complex_type_mark->input_value(0); TENSORFLOW_OP_VALIDATION( From 47f81e0c270000d7174fa2865edc67fbb666c354 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:10:27 +0530 Subject: [PATCH 24/42] Update src/frontends/tensorflow_common/src/op/angle.cpp Co-authored-by: Roman Kazantsev --- src/frontends/tensorflow_common/src/op/angle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index b111a407455918..4c91f81c761dbb 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -39,8 +39,8 @@ OutputVector translate_angle_op(const NodeContext& node) { "[TensorFlow Frontend] inconsistent model: Angle operation expects complex type tensor on input" ); - auto real_index = make_shared(element::i32, Shape{1}, 0); - auto imag_index = make_shared(element::i32, Shape{1}, 1); + auto real_index = make_shared(element::i32, Shape{}, 0); + auto imag_index = make_shared(element::i32, Shape{}, 1); auto gather_axis = make_shared(element::i32, Shape{1}, -1); auto x = make_shared(x, real_index, gather_axis)->output(0); From 1f53a49aa2752c5f207ab81e5eeb8d0d34c999e2 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:10:39 +0530 Subject: [PATCH 25/42] Update src/frontends/tensorflow_common/src/op/angle.cpp Co-authored-by: Roman Kazantsev --- src/frontends/tensorflow_common/src/op/angle.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 4c91f81c761dbb..7942c4edcbad16 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -46,7 +46,6 @@ OutputVector translate_angle_op(const NodeContext& node) { auto x = make_shared(x, real_index, gather_axis)->output(0); auto y = make_shared(x, imag_index, gather_axis)->output(0); - // handle the first condition : x>0 auto div_y_x = make_shared(y, x); auto atan = make_shared(div_y_x); From baf2e20224e6f1f336baf644cab5c1285ce6afda Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:10:54 +0530 Subject: [PATCH 26/42] Update src/frontends/tensorflow_common/src/op/angle.cpp Co-authored-by: Roman Kazantsev --- src/frontends/tensorflow_common/src/op/angle.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 7942c4edcbad16..1ca53cc2b91e17 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -30,7 +30,6 @@ OutputVector translate_angle_op(const NodeContext& node) { auto complex = node.get_input(0); auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); - element::Type complex_part_type = complex_type_mark->get_complex_part_type(); complex = complex_type_mark->input_value(0); TENSORFLOW_OP_VALIDATION( From 5d52e538832b04a677f1dadb13800e611101e995 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:51:40 +0530 Subject: [PATCH 27/42] Update angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 1ca53cc2b91e17..546a4bc8d99335 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -6,7 +6,7 @@ #include "openvino/op/add.hpp" #include "openvino/op/atan.hpp" #include "openvino/op/constant.hpp" -#include "openvino/op/convert_like.hpp" +#include "openvino/op/convert.hpp" #include "openvino/op/divide.hpp" #include "openvino/op/equal.hpp" #include "openvino/op/greater.hpp" @@ -28,6 +28,7 @@ namespace op { OutputVector translate_angle_op(const NodeContext& node) { default_op_checks(node, 1, {"Angle"}, true); auto complex = node.get_input(0); + auto result_type = node.get_input(1); auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); complex = complex_type_mark->input_value(0); @@ -78,9 +79,10 @@ OutputVector translate_angle_op(const NodeContext& node) { auto const_minus_two = create_same_type_const_scalar(x, -2); auto pi_div_minus_two = make_shared(const_pi, const_minus_two); result = make_shared(cond4, pi_div_two, result); + result_changed_type = make_shared(result, result_type); - set_node_name(node.get_name(), result.get_node_shared_ptr()); - return {result}; + set_node_name(node.get_name(), result_changed_type.get_node_shared_ptr()); + return {result_changed_type}; } } // namespace op } // namespace tensorflow From cb634ce7c749ad9526e91f1993560a0d47f4e7cb Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:03:35 +0530 Subject: [PATCH 28/42] Update angle.cpp From f59a789c714010f0b143d4cd8e9defe6bf0ca663 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Mon, 4 Mar 2024 21:55:08 +0400 Subject: [PATCH 29/42] Update src/frontends/tensorflow_common/src/op/angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 546a4bc8d99335..8865ba0f690f59 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -28,7 +28,7 @@ namespace op { OutputVector translate_angle_op(const NodeContext& node) { default_op_checks(node, 1, {"Angle"}, true); auto complex = node.get_input(0); - auto result_type = node.get_input(1); + auto result_type = node.get_attribute("Tout"); auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); complex = complex_type_mark->input_value(0); From 197407d325d0548f33550544ae959620ed256f21 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Mon, 4 Mar 2024 21:56:38 +0400 Subject: [PATCH 30/42] Update tests/layer_tests/tensorflow_tests/test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index f3e0d5606b8343..73d10944ae4831 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -9,13 +9,13 @@ class TestAngle(CommonTFLayerTest): def _prepare_input(self, inputs_info): - assert 'y' in inputs_info - assert 'x' in inputs_info - y_shape = inputs_info['y'] - x_shape = inputs_info['x'] + assert 'y:0' in inputs_info + assert 'x:0' in inputs_info + y_shape = inputs_info['y:0'] + x_shape = inputs_info['x:0'] inputs_data = {} - inputs_data['y'] = np.random.rand(*y_shape).astype(self.input_type) - np.random.rand(*y_shape).astype(self.input_type) - inputs_data['x'] = np.random.rand(*x_shape).astype(self.input_type) - np.random.rand(*x_shape).astype(self.input_type) + inputs_data['y:0'] = np.random.rand(*y_shape).astype(self.input_type) - np.random.rand(*y_shape).astype(self.input_type) + inputs_data['x:0'] = np.random.rand(*x_shape).astype(self.input_type) - np.random.rand(*x_shape).astype(self.input_type) return inputs_data def create_angle_net(self, input_shape, input_type): From 6cb64005037b6d662522c5b48fe5537b7aa4040d Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:16:32 +0530 Subject: [PATCH 31/42] Update angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 8865ba0f690f59..97bb4740173a18 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -34,10 +34,9 @@ OutputVector translate_angle_op(const NodeContext& node) { complex = complex_type_mark->input_value(0); TENSORFLOW_OP_VALIDATION( - node, - complex_type_mark, - "[TensorFlow Frontend] inconsistent model: Angle operation expects complex type tensor on input" - ); + node, + complex_type_mark, + "[TensorFlow Frontend] inconsistent model: Angle operation expects complex type tensor on input"); auto real_index = make_shared(element::i32, Shape{}, 0); auto imag_index = make_shared(element::i32, Shape{}, 1); @@ -79,7 +78,7 @@ OutputVector translate_angle_op(const NodeContext& node) { auto const_minus_two = create_same_type_const_scalar(x, -2); auto pi_div_minus_two = make_shared(const_pi, const_minus_two); result = make_shared(cond4, pi_div_two, result); - result_changed_type = make_shared(result, result_type); + result_changed_type = make_shared(result, result_type); set_node_name(node.get_name(), result_changed_type.get_node_shared_ptr()); return {result_changed_type}; From 2c51435a856214aba649851fc355ce4c3624b978 Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Tue, 5 Mar 2024 21:45:38 +0530 Subject: [PATCH 32/42] Update angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 97bb4740173a18..f4e6fd98a9e748 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -9,6 +9,7 @@ #include "openvino/op/convert.hpp" #include "openvino/op/divide.hpp" #include "openvino/op/equal.hpp" +#include "openvino/op/gather.hpp" #include "openvino/op/greater.hpp" #include "openvino/op/greater_eq.hpp" #include "openvino/op/less.hpp" @@ -26,7 +27,8 @@ namespace tensorflow { namespace op { OutputVector translate_angle_op(const NodeContext& node) { - default_op_checks(node, 1, {"Angle"}, true); + default_op_checks(node, 2, {"Angle"}, true); + auto complex = node.get_input(0); auto result_type = node.get_attribute("Tout"); @@ -38,12 +40,13 @@ OutputVector translate_angle_op(const NodeContext& node) { complex_type_mark, "[TensorFlow Frontend] inconsistent model: Angle operation expects complex type tensor on input"); + auto complex = complex_type_mark->input_value(0) auto real_index = make_shared(element::i32, Shape{}, 0); auto imag_index = make_shared(element::i32, Shape{}, 1); auto gather_axis = make_shared(element::i32, Shape{1}, -1); - auto x = make_shared(x, real_index, gather_axis)->output(0); - auto y = make_shared(x, imag_index, gather_axis)->output(0); + auto x = make_shared(complex, real_index, gather_axis)->output(0); + auto y = make_shared(complex, imag_index, gather_axis)->output(0); // handle the first condition : x>0 auto div_y_x = make_shared(y, x); @@ -77,7 +80,7 @@ OutputVector translate_angle_op(const NodeContext& node) { auto cond4 = make_shared(is_x_zero, is_y_negative); auto const_minus_two = create_same_type_const_scalar(x, -2); auto pi_div_minus_two = make_shared(const_pi, const_minus_two); - result = make_shared(cond4, pi_div_two, result); + result = make_shared(cond4, pi_div_two, result); result_changed_type = make_shared(result, result_type); set_node_name(node.get_name(), result_changed_type.get_node_shared_ptr()); From 6d2c581bde35f3b0eec4fb3de5ea756a288a786a Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Wed, 6 Mar 2024 07:53:30 +0530 Subject: [PATCH 33/42] Update angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index f4e6fd98a9e748..8f05accd3de1ac 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -49,7 +49,7 @@ OutputVector translate_angle_op(const NodeContext& node) { auto y = make_shared(complex, imag_index, gather_axis)->output(0); // handle the first condition : x>0 - auto div_y_x = make_shared(y, x); + aut div_y_x = make_shared(y, x); auto atan = make_shared(div_y_x); auto const_zero = create_same_type_const_scalar(x, 0); auto result = atan->output(0); From e864216c2d2a7155e34646d4829c3029986d98ef Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Wed, 6 Mar 2024 07:56:14 +0530 Subject: [PATCH 34/42] Update angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 8f05accd3de1ac..998f5bca3559fc 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -49,7 +49,7 @@ OutputVector translate_angle_op(const NodeContext& node) { auto y = make_shared(complex, imag_index, gather_axis)->output(0); // handle the first condition : x>0 - aut div_y_x = make_shared(y, x); + auto div_y_x = make_shared(y, x); auto atan = make_shared(div_y_x); auto const_zero = create_same_type_const_scalar(x, 0); auto result = atan->output(0); @@ -84,7 +84,7 @@ OutputVector translate_angle_op(const NodeContext& node) { result_changed_type = make_shared(result, result_type); set_node_name(node.get_name(), result_changed_type.get_node_shared_ptr()); - return {result_changed_type}; + {result_changed_type}; } } // namespace op } // namespace tensorflow From d5c4920c804c06d6fb92bf393909be2fe2fc3715 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Wed, 6 Mar 2024 11:33:22 +0400 Subject: [PATCH 35/42] Apply suggestions from code review --- src/frontends/tensorflow_common/src/op/angle.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 998f5bca3559fc..b0c29ce92e3f2b 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -28,19 +28,17 @@ namespace op { OutputVector translate_angle_op(const NodeContext& node) { default_op_checks(node, 2, {"Angle"}, true); - auto complex = node.get_input(0); auto result_type = node.get_attribute("Tout"); auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); - complex = complex_type_mark->input_value(0); TENSORFLOW_OP_VALIDATION( node, complex_type_mark, "[TensorFlow Frontend] inconsistent model: Angle operation expects complex type tensor on input"); - auto complex = complex_type_mark->input_value(0) + auto complex = complex_type_mark->input_value(0); auto real_index = make_shared(element::i32, Shape{}, 0); auto imag_index = make_shared(element::i32, Shape{}, 1); auto gather_axis = make_shared(element::i32, Shape{1}, -1); From 58e5a720551db5491f3223b50811b6aa518b6d1d Mon Sep 17 00:00:00 2001 From: rghvsh <116428320+rghvsh@users.noreply.github.com> Date: Sat, 23 Mar 2024 22:41:39 +0530 Subject: [PATCH 36/42] Update angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index b0c29ce92e3f2b..aade5b52134929 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -38,6 +38,7 @@ OutputVector translate_angle_op(const NodeContext& node) { complex_type_mark, "[TensorFlow Frontend] inconsistent model: Angle operation expects complex type tensor on input"); + element::Type complex_part_type = complex_type_mark->get_complex_part_type(); auto complex = complex_type_mark->input_value(0); auto real_index = make_shared(element::i32, Shape{}, 0); auto imag_index = make_shared(element::i32, Shape{}, 1); @@ -78,8 +79,8 @@ OutputVector translate_angle_op(const NodeContext& node) { auto cond4 = make_shared(is_x_zero, is_y_negative); auto const_minus_two = create_same_type_const_scalar(x, -2); auto pi_div_minus_two = make_shared(const_pi, const_minus_two); - result = make_shared(cond4, pi_div_two, result); - result_changed_type = make_shared(result, result_type); + result = make_shared(cond4, pi_div_two, result); + auto result_changed_type = make_shared(result, result_type); set_node_name(node.get_name(), result_changed_type.get_node_shared_ptr()); {result_changed_type}; From 370359be22d858d396bac55d86be7111f8610807 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sun, 24 Mar 2024 13:27:13 +0400 Subject: [PATCH 37/42] Update src/frontends/tensorflow_common/src/op/angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index aade5b52134929..322a72c4f60e3c 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -83,7 +83,7 @@ OutputVector translate_angle_op(const NodeContext& node) { auto result_changed_type = make_shared(result, result_type); set_node_name(node.get_name(), result_changed_type.get_node_shared_ptr()); - {result_changed_type}; + return {result_changed_type}; } } // namespace op } // namespace tensorflow From 1c22d7ed35d07b699ba24c18ecd1814e67c44b00 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sun, 24 Mar 2024 16:28:09 +0400 Subject: [PATCH 38/42] Update src/frontends/tensorflow_common/src/op/angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 322a72c4f60e3c..09259a6c6fec72 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -80,7 +80,7 @@ OutputVector translate_angle_op(const NodeContext& node) { auto const_minus_two = create_same_type_const_scalar(x, -2); auto pi_div_minus_two = make_shared(const_pi, const_minus_two); result = make_shared(cond4, pi_div_two, result); - auto result_changed_type = make_shared(result, result_type); + auto result_changed_type = make_shared(result, result_type)->output(0); set_node_name(node.get_name(), result_changed_type.get_node_shared_ptr()); return {result_changed_type}; From 32d910d2cb353d21a1440256e9d70bd2acc728aa Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sun, 24 Mar 2024 17:26:08 +0400 Subject: [PATCH 39/42] Update src/frontends/tensorflow_common/src/op/angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 09259a6c6fec72..5422113c42803f 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -38,8 +38,7 @@ OutputVector translate_angle_op(const NodeContext& node) { complex_type_mark, "[TensorFlow Frontend] inconsistent model: Angle operation expects complex type tensor on input"); - element::Type complex_part_type = complex_type_mark->get_complex_part_type(); - auto complex = complex_type_mark->input_value(0); + complex = complex_type_mark->input_value(0); auto real_index = make_shared(element::i32, Shape{}, 0); auto imag_index = make_shared(element::i32, Shape{}, 1); auto gather_axis = make_shared(element::i32, Shape{1}, -1); From 8d24ef26a5e3600b2ba2b91375321a0f4fbfefc3 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sun, 24 Mar 2024 20:06:03 +0400 Subject: [PATCH 40/42] Update tests/layer_tests/tensorflow_tests/test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index 73d10944ae4831..ccc4d90dc07224 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -41,7 +41,7 @@ def create_angle_net(self, input_shape, input_type): @pytest.mark.precommit_tf_fe @pytest.mark.nightly def test_angle(self, params, ie_device, precision, ir_version, temp_dir, - use_new_frontend, use_old_api): + use_legacy_frontend): self._test(*self.create_angle_net(**params), ie_device, precision, ir_version, temp_dir=temp_dir, - use_new_frontend=use_new_frontend, use_old_api=use_old_api) + use_legacy_frontend=use_legacy_frontend) From a37e905e298342174bed1652b7b2679c51303d75 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sun, 24 Mar 2024 20:40:45 +0400 Subject: [PATCH 41/42] Update tests/layer_tests/tensorflow_tests/test_tf_angle.py --- tests/layer_tests/tensorflow_tests/test_tf_angle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_angle.py b/tests/layer_tests/tensorflow_tests/test_tf_angle.py index ccc4d90dc07224..7c7d35a3e99c9c 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_angle.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_angle.py @@ -25,8 +25,8 @@ def create_angle_net(self, input_shape, input_type): with tf.compat.v1.Session() as sess: y = tf.compat.v1.placeholder(input_type, input_shape, 'y') x = tf.compat.v1.placeholder(input_type, input_shape, 'x') - complex = tf.raw_ops.complex(real = x,imag =y) - tf.raw_ops.Angle(input = x) + complex = tf.raw_ops.Complex(real=x, imag=y) + tf.raw_ops.Angle(input=complex) tf.compat.v1.global_variables_initializer() tf_net = sess.graph_def From 49b9240f3703cd79d0a276c36b903be3117ff1e9 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Sun, 24 Mar 2024 21:26:19 +0400 Subject: [PATCH 42/42] Update src/frontends/tensorflow_common/src/op/angle.cpp --- src/frontends/tensorflow_common/src/op/angle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/tensorflow_common/src/op/angle.cpp b/src/frontends/tensorflow_common/src/op/angle.cpp index 5422113c42803f..a60363216b7d55 100644 --- a/src/frontends/tensorflow_common/src/op/angle.cpp +++ b/src/frontends/tensorflow_common/src/op/angle.cpp @@ -27,7 +27,7 @@ namespace tensorflow { namespace op { OutputVector translate_angle_op(const NodeContext& node) { - default_op_checks(node, 2, {"Angle"}, true); + default_op_checks(node, 1, {"Angle"}, true); auto complex = node.get_input(0); auto result_type = node.get_attribute("Tout");