Parallel execution of TensorFlow Layer 1 Python tests (#22173)
* Update TF Layer 1 tests * Enable parallel execution of tests * Fix typo * Fix typo * Enable parallel tensorflow tests for windows --------- Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
This commit is contained in:
parent
45f62850f3
commit
1a8f72f342
|
|
@ -249,7 +249,7 @@ jobs:
|
|||
run: |
|
||||
# requires 'unit_tests' from 'mo'
|
||||
export PYTHONPATH=${INSTALL_TEST_DIR}/mo
|
||||
python3 -m pytest ${LAYER_TESTS_INSTALL_DIR}/tensorflow_tests/ --use_new_frontend -m precommit_tf_fe --junitxml=${INSTALL_TEST_DIR}/TEST-tf_fe.xml
|
||||
python3 -m pytest ${LAYER_TESTS_INSTALL_DIR}/tensorflow_tests/ --use_new_frontend -m precommit_tf_fe -n logical --junitxml=${INSTALL_TEST_DIR}/TEST-tf_fe.xml
|
||||
env:
|
||||
TEST_DEVICE: CPU
|
||||
TEST_PRECISION: FP16
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ jobs:
|
|||
run: |
|
||||
:: requires 'unit_tests' from 'tools/mo'
|
||||
set PYTHONPATH=${{ env.INSTALL_TEST_DIR }}\mo;%PYTHONPATH%
|
||||
python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/tensorflow_tests/ --use_new_frontend -m precommit_tf_fe --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-tf_fe.xml
|
||||
python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/tensorflow_tests/ --use_new_frontend -n logical -m precommit_tf_fe --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-tf_fe.xml
|
||||
env:
|
||||
TEST_DEVICE: CPU
|
||||
TEST_PRECISION: FP16
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ from common.tf_layer_test_class import CommonTFLayerTest
|
|||
# Documentation: https://www.tensorflow.org/api_docs/python/tf/raw_ops/ArgMin
|
||||
# https://www.tensorflow.org/api_docs/python/tf/raw_ops/ArgMax
|
||||
|
||||
OPS = {
|
||||
'tf.raw_ops.ArgMax': tf.raw_ops.ArgMax,
|
||||
'tf.raw_ops.ArgMin': tf.raw_ops.ArgMin
|
||||
}
|
||||
|
||||
class TestArgMinMax(CommonTFLayerTest):
|
||||
def _prepare_input(self, inputs_info):
|
||||
assert 'input' in inputs_info
|
||||
|
|
@ -41,24 +46,24 @@ class TestArgMinMax(CommonTFLayerTest):
|
|||
return tf_net, ref_net
|
||||
|
||||
test_data = [
|
||||
dict(input_shape=[20], dimension=0),
|
||||
dict(input_shape=[20, 30], dimension=1),
|
||||
dict(input_shape=[2, 30, 3, 4], dimension=2),
|
||||
[[20], 0],
|
||||
[[20, 30], 1],
|
||||
[[2, 30, 3, 4], 2],
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_data)
|
||||
@pytest.mark.parametrize("input_shape, dimension", test_data)
|
||||
@pytest.mark.parametrize("input_type", [np.float32, np.int32])
|
||||
@pytest.mark.parametrize("output_type", [tf.int32, tf.int64])
|
||||
@pytest.mark.parametrize("op_type", [tf.raw_ops.ArgMax, tf.raw_ops.ArgMin])
|
||||
@pytest.mark.parametrize("op_type", ['tf.raw_ops.ArgMax', 'tf.raw_ops.ArgMin'])
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.xfail(condition=platform.system() == 'Linux' and platform.machine() in ['arm', 'armv7l',
|
||||
'aarch64',
|
||||
'arm64', 'ARM64'],
|
||||
reason='Ticket - 126314')
|
||||
def test_argmin_max_net(self, params, input_type, output_type, op_type, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
def test_argmin_max_net(self, input_shape, dimension, input_type, output_type, op_type, ie_device, precision, ir_version, temp_dir, use_new_frontend):
|
||||
params = dict(input_shape=input_shape, dimension=dimension)
|
||||
self._test(*self.create_argmin_max_net(**params, input_type=input_type,
|
||||
output_type=output_type, op_type=op_type),
|
||||
output_type=output_type, op_type=OPS[op_type]),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@ import tensorflow as tf
|
|||
from common.tf_layer_test_class import CommonTFLayerTest
|
||||
|
||||
|
||||
OPS = {
|
||||
"tf.raw_ops.CheckNumerics": tf.raw_ops.CheckNumerics,
|
||||
"tf.raw_ops.CheckNumericsV2": tf.raw_ops.CheckNumericsV2
|
||||
}
|
||||
|
||||
class TestCheckNumerics(CommonTFLayerTest):
|
||||
def _prepare_input(self, inputs_info):
|
||||
assert 'x' in inputs_info
|
||||
|
|
@ -33,15 +38,16 @@ class TestCheckNumerics(CommonTFLayerTest):
|
|||
return tf_net, None
|
||||
|
||||
test_data_basic = [
|
||||
dict(input_shape=[2, 6], input_type=np.float32, op=tf.raw_ops.CheckNumerics),
|
||||
dict(input_shape=[3, 4, 5], input_type=np.float32, op=tf.raw_ops.CheckNumericsV2),
|
||||
[[2, 6], np.float32, 'tf.raw_ops.CheckNumerics'],
|
||||
[[3, 4, 5], np.float32, 'tf.raw_ops.CheckNumericsV2'],
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_data_basic)
|
||||
@pytest.mark.parametrize("input_shape, input_type, op", test_data_basic)
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
def test_check_numerics_basic(self, params, ie_device, precision, ir_version, temp_dir,
|
||||
def test_check_numerics_basic(self, input_shape, input_type, op, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
params = dict(input_shape=input_shape, input_type=input_type, op=OPS[op])
|
||||
self._test(*self.create_check_numerics_net(**params),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,21 @@ import tensorflow as tf
|
|||
from common.tf_layer_test_class import CommonTFLayerTest
|
||||
|
||||
|
||||
OPS = {
|
||||
'tf.raw_ops.IRFFT': tf.raw_ops.IRFFT,
|
||||
'tf.raw_ops.IRFFT2D': tf.raw_ops.IRFFT2D,
|
||||
'tf.raw_ops.IRFFT3D': tf.raw_ops.IRFFT3D,
|
||||
'tf.raw_ops.FFT': tf.raw_ops.FFT,
|
||||
'tf.raw_ops.FFT2D': tf.raw_ops.FFT2D,
|
||||
'tf.raw_ops.FFT3D': tf.raw_ops.FFT3D,
|
||||
'tf.raw_ops.IFFT': tf.raw_ops.IFFT,
|
||||
'tf.raw_ops.IFFT2D': tf.raw_ops.IFFT2D,
|
||||
'tf.raw_ops.IFFT3D': tf.raw_ops.IFFT3D,
|
||||
'tf.raw_ops.RFFT': tf.raw_ops.RFFT,
|
||||
'tf.raw_ops.RFFT2D': tf.raw_ops.RFFT2D,
|
||||
'tf.raw_ops.RFFT3D': tf.raw_ops.RFFT3D
|
||||
}
|
||||
|
||||
class TestComplexFFT(CommonTFLayerTest):
|
||||
def _prepare_input(self, inputs_info):
|
||||
rng = np.random.default_rng()
|
||||
|
|
@ -41,30 +56,31 @@ class TestComplexFFT(CommonTFLayerTest):
|
|||
return tf_net, None
|
||||
|
||||
test_data_basic = [
|
||||
dict(input_shape=[1, 50, 2], shift_roll=[10, 1], axis_roll=[-2, -1]),
|
||||
dict(input_shape=[4, 20, 3], shift_roll=[2, 10], axis_roll=[0, 1]),
|
||||
dict(input_shape=[1, 50, 50, 2], shift_roll=[10, 20], axis_roll=[-2, -1]),
|
||||
dict(input_shape=[4, 20, 30, 3], shift_roll=[2, 10], axis_roll=[0, 1]),
|
||||
dict(input_shape=[1, 50, 50, 30, 2], shift_roll=[10, 20, 4], axis_roll=[-3, -2, -1]),
|
||||
dict(input_shape=[4, 20, 30, 10, 3], shift_roll=[2, 10], axis_roll=[1, 2]),
|
||||
[[1, 50, 2], [10, 1], [-2, -1]],
|
||||
[[4, 20, 3], [2, 10], [0, 1]],
|
||||
[[1, 50, 50, 2], [10, 20], [-2, -1]],
|
||||
[[4, 20, 30, 3], [2, 10], [0, 1]],
|
||||
[[1, 50, 50, 30, 2], [10, 20, 4], [-3, -2, -1]],
|
||||
[[4, 20, 30, 10, 3], [2, 10], [1, 2]],
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("fft_op", [
|
||||
tf.raw_ops.FFT, tf.raw_ops.FFT2D, tf.raw_ops.FFT3D,
|
||||
tf.raw_ops.IFFT, tf.raw_ops.IFFT2D, tf.raw_ops.IFFT3D
|
||||
"tf.raw_ops.FFT", "tf.raw_ops.FFT2D", "tf.raw_ops.FFT3D",
|
||||
"tf.raw_ops.IFFT", "tf.raw_ops.IFFT2D", "tf.raw_ops.IFFT3D"
|
||||
])
|
||||
@pytest.mark.parametrize("params", test_data_basic)
|
||||
@pytest.mark.parametrize("input_shape, shift_roll, axis_roll", test_data_basic)
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.xfail(condition=platform.system() == 'Linux' and platform.machine() in ['arm', 'armv7l',
|
||||
'aarch64',
|
||||
'arm64', 'ARM64'],
|
||||
reason='Ticket - 126314')
|
||||
def test_complex_fft_basic(self, params, fft_op,
|
||||
def test_complex_fft_basic(self, input_shape, shift_roll, axis_roll, fft_op,
|
||||
ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
params = dict(input_shape=input_shape, shift_roll=shift_roll, axis_roll=axis_roll)
|
||||
self._test(
|
||||
*self.create_complex_fft_net(**params, fft_op=fft_op),
|
||||
*self.create_complex_fft_net(**params, fft_op=OPS[fft_op]),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend, custom_eps=1e-2)
|
||||
|
||||
|
|
@ -95,20 +111,19 @@ class TestComplexAbs(CommonTFLayerTest):
|
|||
return tf_net, None
|
||||
|
||||
test_data_basic = [
|
||||
dict(input_shape=[]),
|
||||
dict(input_shape=[2]),
|
||||
dict(input_shape=[1, 3]),
|
||||
dict(input_shape=[2, 3, 4]),
|
||||
dict(input_shape=[3, 4, 5, 6]),
|
||||
[],
|
||||
[2],
|
||||
[1, 3],
|
||||
[2, 3, 4],
|
||||
[3, 4, 5, 6],
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_data_basic)
|
||||
@pytest.mark.parametrize("input_shape", test_data_basic)
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
def test_complex_abs_basic(self, params, ie_device, precision, ir_version, temp_dir,
|
||||
def test_complex_abs_basic(self, input_shape, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
self._test(
|
||||
*self.create_complex_abs_net(**params),
|
||||
*self.create_complex_abs_net(input_shape),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend)
|
||||
|
||||
|
|
@ -138,18 +153,19 @@ class TestComplexRFFT(CommonTFLayerTest):
|
|||
return tf_net, None
|
||||
|
||||
test_data_basic = [
|
||||
dict(input_shape=[1, 3, 20], fft_length=[10], rfft_op=tf.raw_ops.RFFT),
|
||||
dict(input_shape=[1, 3, 20], fft_length=[20], rfft_op=tf.raw_ops.RFFT),
|
||||
dict(input_shape=[1, 3, 20, 40], fft_length=[20, 10], rfft_op=tf.raw_ops.RFFT2D),
|
||||
dict(input_shape=[1, 3, 20, 40], fft_length=[10, 40], rfft_op=tf.raw_ops.RFFT2D),
|
||||
dict(input_shape=[1, 2, 10, 20, 5], fft_length=[2, 5, 3], rfft_op=tf.raw_ops.RFFT3D),
|
||||
[[1, 3, 20], [10], 'tf.raw_ops.RFFT'],
|
||||
[[1, 3, 20], [20], 'tf.raw_ops.RFFT'],
|
||||
[[1, 3, 20, 40], [20, 10], 'tf.raw_ops.RFFT2D'],
|
||||
[[1, 3, 20, 40], [10, 40], 'tf.raw_ops.RFFT2D'],
|
||||
[[1, 2, 10, 20, 5], [2, 5, 3], 'tf.raw_ops.RFFT3D']
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_data_basic)
|
||||
@pytest.mark.parametrize("input_shape, fft_length, rfft_op", test_data_basic)
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
def test_complex_rfft_basic(self, params, ie_device, precision, ir_version, temp_dir,
|
||||
def test_complex_rfft_basic(self, input_shape, fft_length, rfft_op, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
params = dict(input_shape=input_shape, fft_length=fft_length, rfft_op=OPS[rfft_op])
|
||||
self._test(
|
||||
*self.create_complex_rfft_net(**params),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
|
|
@ -183,19 +199,19 @@ class TestComplexIRFFT(CommonTFLayerTest):
|
|||
return tf_net, None
|
||||
|
||||
test_data_basic = [
|
||||
dict(input_shape=[1, 3, 20], fft_length=[10], irfft_op=tf.raw_ops.IRFFT),
|
||||
dict(input_shape=[1, 3, 20], fft_length=[20], irfft_op=tf.raw_ops.IRFFT),
|
||||
dict(input_shape=[1, 3, 20, 40], fft_length=[20, 10], irfft_op=tf.raw_ops.IRFFT2D),
|
||||
dict(input_shape=[1, 3, 20, 40], fft_length=[10, 40], irfft_op=tf.raw_ops.IRFFT2D),
|
||||
pytest.param(dict(input_shape=[1, 10, 20, 30, 5], fft_length=[2, 3, 4], irfft_op=tf.raw_ops.IRFFT3D),
|
||||
marks=pytest.mark.xfail(reason="accuracy-issue-124452"))
|
||||
[[1, 3, 20], [10], 'tf.raw_ops.IRFFT'],
|
||||
[[1, 3, 20], [20], 'tf.raw_ops.IRFFT'],
|
||||
[[1, 3, 20, 40], [20, 10], 'tf.raw_ops.IRFFT2D'],
|
||||
[[1, 3, 20, 40], [10, 40], 'tf.raw_ops.IRFFT2D'],
|
||||
pytest.param([1, 10, 20, 30, 5], [2, 3, 4], 'tf.raw_ops.IRFFT3D',
|
||||
marks=pytest.mark.xfail(reason="accuracy-issue-124452"))
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_data_basic)
|
||||
@pytest.mark.parametrize("input_shape, fft_length, irfft_op", test_data_basic)
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
def test_complex_irfft_basic(self, params, ie_device, precision, ir_version, temp_dir,
|
||||
def test_complex_irfft_basic(self, input_shape, fft_length, irfft_op, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
params = dict(input_shape=input_shape, fft_length=fft_length, irfft_op=OPS[irfft_op])
|
||||
self._test(
|
||||
*self.create_complex_irfft_net(**params),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,12 @@ import tensorflow as tf
|
|||
from common.tf_layer_test_class import CommonTFLayerTest
|
||||
|
||||
|
||||
OPS = {
|
||||
'tf.raw_ops.FakeQuantWithMinMaxVarsPerChannel': tf.raw_ops.FakeQuantWithMinMaxVarsPerChannel,
|
||||
'tf.raw_ops.FakeQuantWithMinMaxVars': tf.raw_ops.FakeQuantWithMinMaxVars,
|
||||
'tf.raw_ops.FakeQuantWithMinMaxArgs': tf.raw_ops.FakeQuantWithMinMaxArgs
|
||||
}
|
||||
|
||||
class TestFakeQuantWithMinMaxVars(CommonTFLayerTest):
|
||||
def _prepare_input(self, inputs_info):
|
||||
# generate elements so that the input tensor may contain repeating elements
|
||||
|
|
@ -32,38 +38,36 @@ class TestFakeQuantWithMinMaxVars(CommonTFLayerTest):
|
|||
|
||||
test_basic = [
|
||||
# test FakeQuantWithMinMaxVars
|
||||
dict(inputs_shape=[2, 6, 4], min_value=-3, max_value=4, num_bits=None, narrow_range=None),
|
||||
dict(inputs_shape=[3, 2, 1, 5], min_value=-4, max_value=5, num_bits=14, narrow_range=True),
|
||||
dict(inputs_shape=[3, 2, 4], min_value=2, max_value=4, num_bits=10, narrow_range=False),
|
||||
dict(inputs_shape=[1, 2, 3], min_value=-6, max_value=-3, num_bits=8, narrow_range=True),
|
||||
[[2, 6, 4], -3, 4, None, None],
|
||||
[[3, 2, 1, 5], -4, 5, 14, True],
|
||||
[[3, 2, 4], 2, 4, 10, False],
|
||||
[[1, 2, 3], -6, -3, 8, True],
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_basic)
|
||||
@pytest.mark.parametrize("inputs_shape, min_value, max_value, num_bits, narrow_range", test_basic)
|
||||
@pytest.mark.parametrize("fake_quant_op", [
|
||||
tf.raw_ops.FakeQuantWithMinMaxVars, tf.raw_ops.FakeQuantWithMinMaxArgs
|
||||
'tf.raw_ops.FakeQuantWithMinMaxVars', 'tf.raw_ops.FakeQuantWithMinMaxArgs'
|
||||
])
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
|
||||
reason='Ticket - 122716')
|
||||
def test_fake_quant_with_min_max_vars_basic(self, params, fake_quant_op, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
self._test(*self.create_fake_quant_with_min_max_vars_net(**params, fake_quant_op=fake_quant_op),
|
||||
def test_fake_quant_with_min_max_vars_basic(self, inputs_shape, min_value, max_value, num_bits, narrow_range, fake_quant_op, ie_device, precision, ir_version, temp_dir, use_new_frontend):
|
||||
params = dict(inputs_shape=inputs_shape, min_value=min_value, max_value=max_value, num_bits=num_bits, narrow_range=narrow_range)
|
||||
self._test(*self.create_fake_quant_with_min_max_vars_net(**params, fake_quant_op=OPS[fake_quant_op]),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend)
|
||||
|
||||
test_per_channel_basic = [
|
||||
dict(inputs_shape=[2, 6, 4], min_value=[-4, -3, -5, -8], max_value=[4, 7, 9, 5], num_bits=None,
|
||||
narrow_range=None,
|
||||
fake_quant_op=tf.raw_ops.FakeQuantWithMinMaxVarsPerChannel),
|
||||
[[2, 6, 4], [-4, -3, -5, -8], [4, 7, 9, 5], None, None, 'tf.raw_ops.FakeQuantWithMinMaxVarsPerChannel'],
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_per_channel_basic)
|
||||
@pytest.mark.parametrize("inputs_shape, min_value, max_value, num_bits, narrow_range, fake_quant_op", test_per_channel_basic)
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.xfail("104822")
|
||||
def test_fake_quant_with_min_max_vars_per_channel_basic(self, params, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
def test_fake_quant_with_min_max_vars_per_channel_basic(self, inputs_shape, min_value, max_value, num_bits, narrow_range, fake_quant_op, ie_device, precision, ir_version, temp_dir, use_new_frontend):
|
||||
params=dict(inputs_shape=inputs_shape, min_value=min_value, max_value=max_value, num_bits=num_bits, narrow_range=narrow_range, fake_quant_op=OPS[fake_quant_op])
|
||||
self._test(*self.create_fake_quant_with_min_max_vars_net(**params),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,13 @@ import tensorflow as tf
|
|||
from common.tf_layer_test_class import CommonTFLayerTest
|
||||
|
||||
|
||||
OPS = {
|
||||
'tf.raw_ops.Identity': tf.raw_ops.Identity,
|
||||
'tf.raw_ops.PreventGradient': tf.raw_ops.PreventGradient,
|
||||
'tf.raw_ops.Snapshot': tf.raw_ops.Snapshot,
|
||||
'tf.raw_ops.StopGradient': tf.raw_ops.StopGradient,
|
||||
}
|
||||
|
||||
class TestIdentity(CommonTFLayerTest):
|
||||
def create_identity_net(self, input_shape, identity_op):
|
||||
tf.compat.v1.reset_default_graph()
|
||||
|
|
@ -22,17 +29,18 @@ class TestIdentity(CommonTFLayerTest):
|
|||
return tf_net, None
|
||||
|
||||
test_data_basic = [
|
||||
dict(input_shape=[2], identity_op=tf.raw_ops.Identity),
|
||||
dict(input_shape=[2, 3], identity_op=tf.raw_ops.PreventGradient),
|
||||
dict(input_shape=[], identity_op=tf.raw_ops.Snapshot),
|
||||
dict(input_shape=[1, 2, 3], identity_op=tf.raw_ops.StopGradient)
|
||||
[[2], 'tf.raw_ops.Identity'],
|
||||
[[2, 3], 'tf.raw_ops.PreventGradient'],
|
||||
[[], 'tf.raw_ops.Snapshot'],
|
||||
[[1, 2, 3], 'tf.raw_ops.StopGradient']
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_data_basic)
|
||||
@pytest.mark.parametrize("input_shape, identity_op", test_data_basic)
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
def test_identity_basic(self, params, ie_device, precision, ir_version, temp_dir,
|
||||
def test_identity_basic(self, input_shape, identity_op, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
params = dict(input_shape=input_shape, identity_op=OPS[identity_op])
|
||||
self._test(*self.create_identity_net(**params),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@ import tensorflow as tf
|
|||
from common.tf_layer_test_class import CommonTFLayerTest
|
||||
|
||||
|
||||
OPS = {
|
||||
'tf.raw_ops.ResizeBilinear': tf.raw_ops.ResizeBilinear,
|
||||
'tf.raw_ops.ResizeNearestNeighbor': tf.raw_ops.ResizeNearestNeighbor,
|
||||
}
|
||||
|
||||
class TestResize(CommonTFLayerTest):
|
||||
def _prepare_input(self, inputs_info):
|
||||
assert 'images' in inputs_info, "Test error: inputs_info must contain `x`"
|
||||
|
|
@ -34,38 +39,27 @@ class TestResize(CommonTFLayerTest):
|
|||
|
||||
test_data_basic = [
|
||||
# ResizeBilinear testing
|
||||
dict(images_shape=[1, 30, 30, 3], images_type=tf.float32, size_value=[40, 40], align_corners=False,
|
||||
half_pixel_centers=False, resize_op=tf.raw_ops.ResizeBilinear),
|
||||
dict(images_shape=[1, 30, 30, 3], images_type=tf.float64, size_value=[40, 40], align_corners=False,
|
||||
half_pixel_centers=False, resize_op=tf.raw_ops.ResizeBilinear),
|
||||
dict(images_shape=[2, 100, 100, 3], images_type=tf.float32, size_value=[40, 40], align_corners=True,
|
||||
half_pixel_centers=False, resize_op=tf.raw_ops.ResizeBilinear),
|
||||
dict(images_shape=[2, 10, 10, 3], images_type=tf.float32, size_value=[40, 40], align_corners=False,
|
||||
half_pixel_centers=True, resize_op=tf.raw_ops.ResizeBilinear),
|
||||
dict(images_shape=[2, 40, 40, 3], images_type=tf.uint8, size_value=[10, 10], align_corners=False,
|
||||
half_pixel_centers=False, resize_op=tf.raw_ops.ResizeBilinear),
|
||||
dict(images_shape=[1, 40, 40, 3], images_type=tf.int32, size_value=[10, 10], align_corners=False,
|
||||
half_pixel_centers=True, resize_op=tf.raw_ops.ResizeBilinear),
|
||||
[[1, 30, 30, 3], tf.float32, [40, 40], False, False, 'tf.raw_ops.ResizeBilinear'],
|
||||
[[1, 30, 30, 3], tf.float64, [40, 40], False, False, 'tf.raw_ops.ResizeBilinear'],
|
||||
[[2, 100, 100, 3], tf.float32, [40, 40], True, False, 'tf.raw_ops.ResizeBilinear'],
|
||||
[[2, 10, 10, 3], tf.float32, [40, 40], False, True, 'tf.raw_ops.ResizeBilinear'],
|
||||
[[2, 40, 40, 3], tf.uint8, [10, 10], False, False, 'tf.raw_ops.ResizeBilinear'],
|
||||
[[1, 40, 40, 3], tf.int32, [10, 10], False, True, 'tf.raw_ops.ResizeBilinear'],
|
||||
# ResizeNearestNeighbor testing
|
||||
dict(images_shape=[1, 30, 30, 3], images_type=tf.float32, size_value=[40, 40], align_corners=False,
|
||||
half_pixel_centers=False, resize_op=tf.raw_ops.ResizeNearestNeighbor),
|
||||
dict(images_shape=[2, 100, 100, 3], images_type=tf.float32, size_value=[40, 40], align_corners=True,
|
||||
half_pixel_centers=False, resize_op=tf.raw_ops.ResizeNearestNeighbor),
|
||||
dict(images_shape=[2, 10, 10, 3], images_type=tf.float32, size_value=[40, 40], align_corners=False,
|
||||
half_pixel_centers=True, resize_op=tf.raw_ops.ResizeNearestNeighbor),
|
||||
dict(images_shape=[2, 40, 40, 3], images_type=tf.uint8, size_value=[10, 10], align_corners=False,
|
||||
half_pixel_centers=False, resize_op=tf.raw_ops.ResizeNearestNeighbor),
|
||||
dict(images_shape=[1, 40, 40, 3], images_type=tf.int32, size_value=[10, 10], align_corners=False,
|
||||
half_pixel_centers=True, resize_op=tf.raw_ops.ResizeNearestNeighbor),
|
||||
[[1, 30, 30, 3], tf.float32, [40, 40], False, False, 'tf.raw_ops.ResizeNearestNeighbor'],
|
||||
[[2, 100, 100, 3], tf.float32, [40, 40], True, False, 'tf.raw_ops.ResizeNearestNeighbor'],
|
||||
[[2, 10, 10, 3], tf.float32, [40, 40], False, True, 'tf.raw_ops.ResizeNearestNeighbor'],
|
||||
[[2, 40, 40, 3], tf.uint8, [10, 10], False, False, 'tf.raw_ops.ResizeNearestNeighbor'],
|
||||
[[1, 40, 40, 3], tf.int32, [10, 10], False,True, 'tf.raw_ops.ResizeNearestNeighbor'],
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_data_basic)
|
||||
@pytest.mark.parametrize("images_shape, images_type, size_value, align_corners, half_pixel_centers, resize_op", test_data_basic)
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
|
||||
reason='Ticket - 122716')
|
||||
def test_resize_basic(self, params, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend):
|
||||
def test_resize_basic(self, images_shape, images_type, size_value, align_corners, half_pixel_centers, resize_op, ie_device, precision, ir_version, temp_dir, use_new_frontend):
|
||||
params = dict(images_shape=images_shape, images_type=images_type, size_value=size_value, align_corners=align_corners, half_pixel_centers=half_pixel_centers, resize_op=OPS[resize_op])
|
||||
self._test(*self.create_resize_net(**params),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend)
|
||||
|
|
|
|||
Loading…
Reference in New Issue