|
| 1 | +# Copyright (C) 2018-2025 Intel Corporation |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +import numpy as np |
| 5 | +import pytest |
| 6 | +import tensorflow as tf |
| 7 | +from common.tf_layer_test_class import CommonTFLayerTest |
| 8 | + |
| 9 | +rng = np.random.default_rng(3453466) |
| 10 | + |
| 11 | + |
| 12 | +class TestAddTypes(CommonTFLayerTest): |
| 13 | + def _prepare_input(self, inputs_info): |
| 14 | + assert 'x:0' in inputs_info, "Test error: inputs_info must contain `x`" |
| 15 | + x_shape = inputs_info['x:0'] |
| 16 | + inputs_data = {} |
| 17 | + inputs_data['x:0'] = rng.uniform(-3.0, 3.0, x_shape).astype(self.input_type) |
| 18 | + return inputs_data |
| 19 | + |
| 20 | + def create_erfc_net(self, input_shape, input_type): |
| 21 | + self.input_type = input_type |
| 22 | + tf.compat.v1.reset_default_graph() |
| 23 | + # Create the graph and model |
| 24 | + with tf.compat.v1.Session() as sess: |
| 25 | + x = tf.compat.v1.placeholder(input_type, input_shape, 'x') |
| 26 | + tf.raw_ops.Erfc(x=x) |
| 27 | + tf.compat.v1.global_variables_initializer() |
| 28 | + |
| 29 | + tf_net = sess.graph_def |
| 30 | + |
| 31 | + return tf_net, None |
| 32 | + |
| 33 | + @pytest.mark.parametrize("input_shape", [[], [2], [3, 4], [3, 2, 1, 4]]) |
| 34 | + @pytest.mark.parametrize("input_type", [np.float16, np.float32, np.float64]) |
| 35 | + @pytest.mark.precommit |
| 36 | + @pytest.mark.nightly |
| 37 | + def test_erfc(self, input_shape, input_type, |
| 38 | + ie_device, precision, ir_version, temp_dir, |
| 39 | + use_legacy_frontend): |
| 40 | + self._test(*self.create_erfc_net(input_shape, input_type), |
| 41 | + ie_device, precision, ir_version, temp_dir=temp_dir, |
| 42 | + use_legacy_frontend=use_legacy_frontend) |
0 commit comments