Files
openvino/tests/layer_tests/tensorflow_tests/test_tf_MaxPoolWithArgmax.py
T
Andrey Kashchikhin 62f5bd6570 [CI] [GHA] Introduce the Linux ARM64 workflow (#20809)
* add arm as a matrix for build job

* uncomment

* comment

* try inside pipeline

* check location

* another dirs

* try to privide correct action path

* use corrected action

* use newer commit

* use newer commit

* use newer commit

* use newer action commit

* add setting

* rm from pipeline, adapt action iteslf

* add missing deps

* enable samples and debian jobs

* correct yml

* correct image name

* correct syntax, use self-hosted option

* enable onnx runtime and c++, use newer action

* enable Python and CPU Func tests

* add missing deps for arm64

* increase timeout for python tests

* disable some tests, add more time

* skip failing tests

* skip speech sample test on arm

* dummy chang

* skip mxnet mo on arm, run all tests

* rm quotes

* separate linux x86 and arm64 workflows

* rm unused matrix refs, add timeouts

* add skips for c++ tests and some Python tests

* correct cache keys, extend timeout

* skip more python tests

* add more skips: for python and CPU func

* extend cpu func list with skips

* disable cpu func tests and python api 2.0 tests

* rm disable job

* styling, rm pr trigger, rm always(), rm unnecessary changes

* revert

* use ifs instead of comments, provide better wording for skips
2023-12-05 12:14:02 +04:00

78 lines
3.5 KiB
Python

# Copyright (C) 2018-2023 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
class TestMaxPoolWithArgmax(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
assert 'input' in inputs_info
input_shape = inputs_info['input']
inputs_data = {}
inputs_data['input'] = np.random.randint(-5, 5, input_shape).astype(self.input_type)
return inputs_data
def create_max_pool_with_argmax_net(self, input_shape, ksize, strides, input_type, padding, targmax,
include_batch_in_index, with_second_output):
self.input_type = input_type
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
input = tf.compat.v1.placeholder(input_type, input_shape, 'input')
max_pool_with_argmax = tf.raw_ops.MaxPoolWithArgmax(input=input, ksize=ksize, strides=strides,
padding=padding, Targmax=targmax,
include_batch_in_index=include_batch_in_index
)
tf.identity(max_pool_with_argmax[0], name='max_pool')
if with_second_output:
tf.identity(max_pool_with_argmax[1], name='output_indices')
tf.compat.v1.global_variables_initializer()
tf_net = sess.graph_def
return tf_net, None
test_data_basic = [
dict(input_shape=[1, 25, 24, 3],
ksize=[1, 1, 1, 1], strides=[1, 1, 1, 1]),
dict(input_shape=[1, 10, 20, 3],
ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1]),
]
@pytest.mark.parametrize("params", test_data_basic)
@pytest.mark.parametrize("input_type", [
np.float32, np.int32
])
@pytest.mark.parametrize("padding", [
'VALID', 'SAME'
])
@pytest.mark.parametrize("targmax", [
tf.int32, tf.int64
])
@pytest.mark.parametrize("include_batch_in_index", [
True, False
])
@pytest.mark.parametrize("with_second_output", [
True, False
])
@pytest.mark.precommit_tf_fe
@pytest.mark.nightly
@pytest.mark.xfail(condition=platform.system() in ('Linux', 'Darwin') and platform.machine() in ('arm', 'armv7l',
'aarch64',
'arm64', 'ARM64'),
reason='Ticket - 126314, 122716')
def test_max_pool_with_argmax_basic(self, params, input_type, padding, targmax,
include_batch_in_index, with_second_output,
ie_device, precision, ir_version, temp_dir,
use_new_frontend, use_old_api):
self._test(
*self.create_max_pool_with_argmax_net(**params, input_type=input_type, padding=padding, targmax=targmax,
include_batch_in_index=include_batch_in_index,
with_second_output=with_second_output),
ie_device, precision, ir_version, temp_dir=temp_dir,
use_new_frontend=use_new_frontend, use_old_api=use_old_api)