OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
class TestReLU6(CommonTFLayerTest):
def create_relu6_net(self, shape, ir_version):
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
input = tf.compat.v1.placeholder(tf.float32, shape, 'Input')
tf.nn.relu6(input, name='Operation')
tf.compat.v1.global_variables_initializer()
tf_net = sess.graph_def
ref_net = None
return tf_net, ref_net
test_data_precommit = [dict(shape=[1, 3, 50, 100, 224])]
@pytest.mark.parametrize("params", test_data_precommit)
@pytest.mark.precommit
@pytest.mark.nightly
def test_relu6_precommit(self, params, ie_device, precision, ir_version, temp_dir):
self._test(*self.create_relu6_net(**params, ir_version=ir_version),
ie_device, precision, ir_version, temp_dir=temp_dir)
test_data = [dict(shape=[1]),
pytest.param(dict(shape=[1, 224]), marks=pytest.mark.precommit),
dict(shape=[1, 3, 224]),
dict(shape=[1, 3, 100, 224]),
dict(shape=[1, 3, 50, 100, 224])]
@pytest.mark.parametrize("params", test_data)
@pytest.mark.nightly
def test_relu6(self, params, ie_device, precision, ir_version, temp_dir):
self._test(*self.create_relu6_net(**params, ir_version=ir_version),
ie_device, precision, ir_version, temp_dir=temp_dir)