Skip to content

Commit

Permalink
Correct layer test
Browse files Browse the repository at this point in the history
Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
  • Loading branch information
rkazants committed May 25, 2024
1 parent 10c83dc commit 9979e7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions tests/layer_tests/common/utils/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ def generate_ir_python_api(coverage=False, **kwargs):
return 0, ""


def generate_ir_ovc(input_model, **kwargs):
def generate_ir_ovc(input_model, opts):
params = ['ovc', input_model]
for key, value in kwargs.items():
for key, value in opts.items():
# handle optional arguments
params.extend(("--{}".format(key), str(value)))
# both key and values are of string type
params.extend(("--{}".format(key), value))
exit_code, stdout, stderr = shell(params)
return exit_code, stdout, stderr

Expand Down
9 changes: 5 additions & 4 deletions tests/layer_tests/tensorflow_tests/test_tf_StringLower.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

import numpy as np
import os
import platform
import pytest
import tensorflow as tf
Expand Down Expand Up @@ -59,7 +60,7 @@ def test_string_lower(self, input_shape, encoding, strings_dictionary, ie_device
use_legacy_frontend=use_legacy_frontend)


class OVCTestStringLower:
class TestStringLowerOVC:
def prepare_data(self):
inputs_data = {}
inputs_data['input:0'] = np.array(['Some sentence', 'ANOTHER sentenCE'], dtype=str)
Expand All @@ -81,19 +82,19 @@ def create_string_lower_model(self, output_dir):
'aarch64',
'arm64', 'ARM64'],
reason='Ticket - 126314, 132699')
def test_string_lower_with_ovc(self, ie_device, temp_dir):
def test_string_lower_with_ovc(self, ie_device, temp_dir, precision):
if ie_device == 'GPU' or run_in_jenkins():
pytest.skip("operation extension is not supported on GPU")
input_model_path = self.create_string_lower_model(temp_dir)
output_model_path = os.path.join(temp_dir, 'model_string_lower.xml')
return_code, _, _ = generate_ir_ovc(input_model_path, {'output_model', output_model_path})
return_code, _, _ = generate_ir_ovc(input_model_path, {'output_model': output_model_path})
assert return_code == 0, "OVC tool is failed for conversion model {}".format(input_model_path)

import openvino_tokenizers
import openvino as ov
core = ov.Core()
compiled_model = core.compile_model(output_model_path, ie_device)
input_data, ref_data = self.prepare_input()
input_data, ref_data = self.prepare_data()
ov_result = compiled_model(input_data)['StringLower:0']

assert np.array_equal(ov_result, ref_data), 'OpenVINO result does not match the reference:' \
Expand Down

0 comments on commit 9979e7c

Please sign in to comment.