From e8fa9f7b84d1d19e4581f56ef4dd8e88934b878e Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Fri, 6 Dec 2024 20:29:49 +0400 Subject: [PATCH] [TF FE] Run HSVToRGB tests on all platforms (#27945) **Details:** Run HSVToRGB tests on all platforms **Ticket:** TBD --------- Signed-off-by: Kazantsev, Roman --- .../tensorflow_tests/test_tf_HSVToRGB.py | 53 +++++++------------ 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_HSVToRGB.py b/tests/layer_tests/tensorflow_tests/test_tf_HSVToRGB.py index 9f3ab9845fb24f..17df8c52430ec5 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_HSVToRGB.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_HSVToRGB.py @@ -1,32 +1,28 @@ # Copyright (C) 2018-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import platform - import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest +rng = np.random.default_rng(23345) + + class TestHSVToRGB(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'images:0' in inputs_info - if self.special_case == "Black Image": - images_shape = inputs_info['images:0'] - inputs_data = {} - inputs_data['images:0'] = np.zeros(images_shape).astype(self.input_type) - elif self.special_case == "Grayscale Image": - images_shape = inputs_info['images:0'] - inputs_data = {} + images_shape = inputs_info['images:0'] + inputs_data = {} + if self.special_case == 'Black Image': + inputs_data['images:0'] = np.zeros(images_shape).astype(self.input_type) + elif self.special_case == 'Grayscale Image': inputs_data['images:0'] = np.broadcast_to([0, 0, 0.5], images_shape).astype(self.input_type) else: - images_shape = inputs_info['images:0'] - inputs_data = {} - inputs_data['images:0'] = np.random.rand(*images_shape).astype(self.input_type) - + inputs_data['images:0'] = rng.uniform(0.0, 1.0, images_shape).astype(self.input_type) return inputs_data - def create_hsv_to_rgb_net(self, input_shape, input_type, special_case=False): + def create_hsv_to_rgb_net(self, input_shape, input_type, special_case): self.special_case = special_case self.input_type = input_type tf.compat.v1.reset_default_graph() @@ -39,27 +35,16 @@ def create_hsv_to_rgb_net(self, input_shape, input_type, special_case=False): return tf_net, None - # Each input is a tensor of with values in [0,1]. - # The last dimension must be size 3. - test_data_basic = [ - dict(input_shape=[7, 7, 3], input_type=np.float32, special_case="Black Image"), - dict(input_shape=[7, 7, 3], input_type=np.float32, special_case="Grayscale Image"), - dict(input_shape=[5, 5, 3], input_type=np.float32), - dict(input_shape=[5, 23, 27, 3], input_type=np.float64), - dict(input_shape=[3, 4, 13, 15, 3], input_type=np.float64), - ] - - @pytest.mark.parametrize("params", test_data_basic) + @pytest.mark.parametrize('input_shape', [[3], [5, 3], [4, 5, 3], [5, 21, 21, 3]]) + @pytest.mark.parametrize('input_type', [np.float16, np.float32, np.float64]) + @pytest.mark.parametrize('special_case', [None, 'Black Image', 'Grayscale Image']) @pytest.mark.precommit @pytest.mark.nightly - @pytest.mark.xfail(condition=platform.system() in ('Darwin', 'Linux') and platform.machine() in ['arm', 'armv7l', - 'aarch64', - 'arm64', 'ARM64'], - reason='Ticket - 126314, 132699') - def test_hsv_to_rgb_basic(self, params, ie_device, precision, ir_version, temp_dir, - use_legacy_frontend): + def test_hsv_to_rgb_basic(self, input_shape, input_type, special_case, + ie_device, precision, ir_version, temp_dir, + use_legacy_frontend): if ie_device == 'GPU': - pytest.skip("Accuracy mismatch on GPU") - self._test(*self.create_hsv_to_rgb_net(**params), + pytest.skip('158898: accuracy issue on GPU') + self._test(*self.create_hsv_to_rgb_net(input_shape, input_type, special_case), ie_device, precision, ir_version, temp_dir=temp_dir, - use_legacy_frontend=use_legacy_frontend) + use_legacy_frontend=use_legacy_frontend, custom_eps=3 * 1e-3)