[TF FE] Fix sporadic failure for TF1 LRN layer test (#15628)

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
This commit is contained in:
Roman Kazantsev authored and GitHub committed 2023-02-10 14:30:57 +01:00
1 parent bfe77d0c65
commit 19aa1cfe8d
1 file changed
+7 -2
@@ -26,7 +26,12 @@ OutputVector translate_lrn_op(const NodeContext& node) {
auto beta = static_cast<double>(node.get_attribute<float>("beta", 0.5));
// adjust attribute values for opset LRN operation
size_t attr_size = static_cast<size_t>(depth_radius) * 2 + 1;
size_t attr_size = 1;
if (depth_radius % 2 == 0) {
attr_size = static_cast<size_t>(depth_radius) * 2 + 1;
} else {
attr_size = static_cast<size_t>(depth_radius - 1) * 2 + 1;
}
alpha *= static_cast<double>(attr_size);
// currently, plugins fallback to the template to execute this operation
@@ -35,7 +40,7 @@ OutputVector translate_lrn_op(const NodeContext& node) {
// so we have to transpose inputs and outputs due to this limitation
auto axis = make_shared<Constant>(element::i32, Shape{1}, 1);
ov::frontend::tensorflow::convert_nhwc_to_nchw(true, input);
auto lrn = make_shared<LRN>(input, axis, alpha, beta, bias, attr_size)->output(0);
Output<Node> lrn = make_shared<LRN>(input, axis, alpha, beta, bias, attr_size);
ov::frontend::tensorflow::convert_nchw_to_nhwc(true, lrn);
set_node_name(node.get_name(), lrn.get_node_shared_ptr());
return {lrn};