diff --git a/src/frontends/tensorflow/src/op_table.cpp b/src/frontends/tensorflow/src/op_table.cpp index fce3af3f0a235b..7c093d7301a640 100644 --- a/src/frontends/tensorflow/src/op_table.cpp +++ b/src/frontends/tensorflow/src/op_table.cpp @@ -286,6 +286,7 @@ const std::map get_supported_ops() { {"While", CreatorFunction(translate_while_op)}, {"Where", CreatorFunction(translate_where_op)}, {"Xdivy", CreatorFunction(translate_x_div_y_op)}, + {"Xlogy", CreatorFunction(translate_xlogy_op)}, {"ZerosLike", CreatorFunction(translate_zeros_like_op)}, // Translators for SavedModel and MetaGraph diff --git a/src/frontends/tensorflow_common/include/common_op_table.hpp b/src/frontends/tensorflow_common/include/common_op_table.hpp index 17a865acfb0e99..9c1f995f25f1e8 100644 --- a/src/frontends/tensorflow_common/include/common_op_table.hpp +++ b/src/frontends/tensorflow_common/include/common_op_table.hpp @@ -149,6 +149,7 @@ OP_CONVERTER(translate_unravel_index_op); OP_CONVERTER(translate_unsorted_segment_sum_op); OP_CONVERTER(translate_where_op); OP_CONVERTER(translate_x_div_y_op); +OP_CONVERTER(translate_xlogy_op); OP_CONVERTER(translate_zeros_like_op); // Translators for internal operations diff --git a/src/frontends/tensorflow_common/src/op/xlogy.cpp b/src/frontends/tensorflow_common/src/op/xlogy.cpp new file mode 100644 index 00000000000000..8b4f9da063a27e --- /dev/null +++ b/src/frontends/tensorflow_common/src/op/xlogy.cpp @@ -0,0 +1,43 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "common_op_table.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/convert_like.hpp" +#include "openvino/op/equal.hpp" +#include "openvino/op/log.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/select.hpp" + +using namespace std; +using namespace ov::opset10; + +namespace ov { +namespace frontend { +namespace tensorflow { +namespace op { +OutputVector translate_xlogy_op(const NodeContext& node) { + default_op_checks(node, 2, {"Xlogy"}); + auto x = node.get_input(0); + auto y = node.get_input(1); + + // prepare auxiliary zero constant of the same type as the input + auto zero = create_same_type_const_scalar(x, 0); + + // compute a mask to identify where x is equal to 0 + auto is_zero = make_shared(x, zero); + + // compute x * log(y) elementwise + auto xlog_y = make_shared(x, make_shared(y)); + + // create the output tensor using Select to handle the x == 0 condition + auto result = make_shared