Skip to content

Commit

Permalink
[TF FE] Switch on layer test for LookupTableFindV2 with string key (#…
Browse files Browse the repository at this point in the history
…23197)

**Details:** Switch on layer test for LookupTableFindV2 with string key.
Merge after
openvinotoolkit/openvino_tokenizers#50

**Ticket:** 132669

---------

Signed-off-by: Kazantsev, Roman <[email protected]>
  • Loading branch information
rkazants authored Mar 2, 2024
1 parent 17bf1f6 commit 7b46de7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions tests/layer_tests/tensorflow_tests/test_tf_LookupTableFind.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import platform

import numpy as np
import pytest
import tensorflow as tf
Expand Down Expand Up @@ -35,6 +37,8 @@ def create_lookup_table_find_net(self, hash_table_type, keys_shape, keys_type, v
self.keys_type = keys_type
self.all_keys = all_keys
self.invalid_key = invalid_key
if keys_type == str:
keys_type = tf.string
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
Expand Down Expand Up @@ -67,11 +71,10 @@ def create_lookup_table_find_net(self, hash_table_type, keys_shape, keys_type, v
dict(keys_type=np.int32, values_type=tf.string, all_keys=[20, 10, 33, -22, 44, 11],
all_values=['PyTorch', 'TensorFlow', 'JAX', 'Lightning', 'MindSpore', 'OpenVINO'],
default_value='UNKNOWN', invalid_key=1000),
pytest.param(dict(keys_type=str, values_type=np.int64,
all_keys=['PyTorch', 'TensorFlow', 'JAX', 'Lightning', 'MindSpore', 'OpenVINO'],
all_values=[200, 100, 0, -3, 10, 1],
default_value=0, invalid_key='AbraCadabra'),
marks=pytest.mark.xfail(reason="132669 - Support LookupTableFindV2 with string key")),
dict(keys_type=str, values_type=np.int64,
all_keys=['PyTorch', 'TensorFlow', 'JAX', 'Lightning', 'MindSpore', 'OpenVINO'],
all_values=[200, 100, 0, -3, 10, 1],
default_value=0, invalid_key='AbraCadabra'),
]

@pytest.mark.parametrize("hash_table_type", [0, 1])
Expand All @@ -81,6 +84,12 @@ def create_lookup_table_find_net(self, hash_table_type, keys_shape, keys_type, v
@pytest.mark.nightly
def test_lookup_table_find(self, hash_table_type, keys_shape, params, ie_device, precision, ir_version, temp_dir,
use_legacy_frontend):
if params['keys_type'] == str and params['values_type'] == np.int64:
if platform.system() in ('Darwin') or platform.machine() in ['arm', 'armv7l',
'aarch64',
'arm64',
'ARM64']:
pytest.xfail(reason='126314, 132699: Build tokenizers for ARM and MacOS')
self._test(*self.create_lookup_table_find_net(hash_table_type=hash_table_type,
keys_shape=keys_shape, **params),
ie_device, precision, ir_version, temp_dir=temp_dir,
Expand Down

0 comments on commit 7b46de7

Please sign in to comment.