[TF FE][TF Hub] Support FakeQuantWithMinMaxArgs operation (#19154)
Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
This commit is contained in:
@@ -21,9 +21,7 @@ class TestFakeQuantWithMinMaxVars(CommonTFLayerTest):
|
||||
tf.compat.v1.reset_default_graph()
|
||||
with tf.compat.v1.Session() as sess:
|
||||
inputs = tf.compat.v1.placeholder(tf.float32, inputs_shape, 'inputs')
|
||||
min = tf.constant(min_value, dtype=tf.float32)
|
||||
max = tf.constant(max_value, dtype=tf.float32)
|
||||
fake_quant_op(inputs=inputs, min=min, max=max, num_bits=num_bits,
|
||||
fake_quant_op(inputs=inputs, min=min_value, max=max_value, num_bits=num_bits,
|
||||
narrow_range=narrow_range)
|
||||
tf.compat.v1.global_variables_initializer()
|
||||
tf_net = sess.graph_def
|
||||
@@ -32,29 +30,38 @@ 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,
|
||||
fake_quant_op=tf.raw_ops.FakeQuantWithMinMaxVars),
|
||||
dict(inputs_shape=[3, 2, 1, 5], min_value=-4, max_value=5, num_bits=14, narrow_range=True,
|
||||
fake_quant_op=tf.raw_ops.FakeQuantWithMinMaxVars),
|
||||
dict(inputs_shape=[3, 2, 4], min_value=2, max_value=4, num_bits=10, narrow_range=False,
|
||||
fake_quant_op=tf.raw_ops.FakeQuantWithMinMaxVars),
|
||||
dict(inputs_shape=[1, 2, 3], min_value=-6, max_value=-3, num_bits=8, narrow_range=True,
|
||||
fake_quant_op=tf.raw_ops.FakeQuantWithMinMaxVars),
|
||||
|
||||
# test FakeQuantWithMinMaxVarsPerChannel
|
||||
pytest.param(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),
|
||||
marks=pytest.mark.xfail(reason="104822"))
|
||||
|
||||
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),
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", test_basic)
|
||||
@pytest.mark.parametrize("fake_quant_op", [
|
||||
tf.raw_ops.FakeQuantWithMinMaxVars, tf.raw_ops.FakeQuantWithMinMaxArgs
|
||||
])
|
||||
@pytest.mark.precommit_tf_fe
|
||||
@pytest.mark.nightly
|
||||
def test_fake_quant_with_min_max_vars_basic(self, params, ie_device, precision, ir_version, temp_dir,
|
||||
def test_fake_quant_with_min_max_vars_basic(self, params, fake_quant_op, ie_device, precision, ir_version, temp_dir,
|
||||
use_new_frontend,
|
||||
use_old_api):
|
||||
self._test(*self.create_fake_quant_with_min_max_vars_net(**params, fake_quant_op=fake_quant_op),
|
||||
ie_device, precision, ir_version, temp_dir=temp_dir,
|
||||
use_new_frontend=use_new_frontend, use_old_api=use_old_api)
|
||||
|
||||
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),
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("params", 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,
|
||||
use_old_api):
|
||||
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, use_old_api=use_old_api)
|
||||
|
||||
Reference in New Issue
Block a user