From 17c3e67336c6e0f0f9aff14f65abe76821bcf47a Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Tue, 28 Mar 2023 20:43:11 +0400 Subject: [PATCH] [TF FE] Add layer test for Mish activation function (#16557) Signed-off-by: Kazantsev, Roman --- tests/layer_tests/requirements.txt | 1 + .../layer_tests/tensorflow_tests/test_tf_UnaryOps.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/layer_tests/requirements.txt b/tests/layer_tests/requirements.txt index 6aa2b645d23..10c0d6fcfcc 100644 --- a/tests/layer_tests/requirements.txt +++ b/tests/layer_tests/requirements.txt @@ -3,3 +3,4 @@ numpy>=1.19.2 torch torchvision pytest +tensorflow-addons diff --git a/tests/layer_tests/tensorflow_tests/test_tf_UnaryOps.py b/tests/layer_tests/tensorflow_tests/test_tf_UnaryOps.py index c7ba4784c1b..b2ed7ad562a 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_UnaryOps.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_UnaryOps.py @@ -54,6 +54,8 @@ class TestUnaryOps(CommonTFLayerTest): """ import tensorflow as tf + import tensorflow_addons as tfa + self.current_op_type = op_type op_type_to_tf = { 'Abs': tf.math.abs, @@ -72,6 +74,7 @@ class TestUnaryOps(CommonTFLayerTest): 'Floor': tf.math.floor, 'Log': tf.math.log, 'LogicalNot': tf.math.logical_not, + 'Mish': tfa.activations.mish, 'Negative': tf.math.negative, 'Sigmoid': tf.nn.sigmoid, 'Sign': tf.math.sign, @@ -95,7 +98,11 @@ class TestUnaryOps(CommonTFLayerTest): tf_x_shape = permute_nchw_to_nhwc(tf_x_shape, use_new_frontend) input = tf.compat.v1.placeholder(type, tf_x_shape, 'Input') - op_type_to_tf[self.current_op_type](input, name='Operation') + if self.current_op_type == 'Mish': + # Mish has no attribute name + op_type_to_tf[self.current_op_type](input) + else: + op_type_to_tf[self.current_op_type](input, name='Operation') tf.compat.v1.global_variables_initializer() tf_net = sess.graph_def @@ -155,6 +162,7 @@ class TestUnaryOps(CommonTFLayerTest): 'LogicalNot', 'Square', 'Erf', + 'Mish', ]) @pytest.mark.precommit def test_unary_op_precommit(self, params, ie_device, precision, ir_version, temp_dir, op_type, @@ -198,6 +206,7 @@ class TestUnaryOps(CommonTFLayerTest): 'Asinh', 'Square', 'Erf', + 'Mish', ]) @pytest.mark.nightly def test_unary_op(self, params, ie_device, precision, ir_version, temp_dir, op_type,