diff --git a/src/frontends/pytorch/src/op_table.cpp b/src/frontends/pytorch/src/op_table.cpp index f44ad64b2bb..168952a34d3 100644 --- a/src/frontends/pytorch/src/op_table.cpp +++ b/src/frontends/pytorch/src/op_table.cpp @@ -428,6 +428,8 @@ const std::map get_supported_ops_ts() { {"aten::gru", op::translate_gru}, {"aten::gt", op::translate_1to1_match_2_inputs_align_types}, {"aten::hardsigmoid", op::quantizable_op>}, + {"aten::hardsigmoid_", + op::quantizable_op>>}, {"aten::hardswish", op::quantizable_op>}, {"aten::hardswish_", op::quantizable_op>>}, {"aten::hardtanh", op::quantizable_op}, diff --git a/tests/layer_tests/pytorch_tests/test_hadsigmoid.py b/tests/layer_tests/pytorch_tests/test_hadsigmoid.py new file mode 100644 index 00000000000..11c3051bef1 --- /dev/null +++ b/tests/layer_tests/pytorch_tests/test_hadsigmoid.py @@ -0,0 +1,36 @@ +# Copyright (C) 2018-2023 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import pytest + +from pytorch_layer_test_class import PytorchLayerTest + + +class TestHardSigmoid(PytorchLayerTest): + def _prepare_input(self, shape, dtype): + import numpy as np + return (np.random.randn(*shape).astype(dtype),) + + def create_model(self, inplace): + import torch + import torch.nn.functional as F + + class aten_hardsigmoid(torch.nn.Module): + def __init__(self, inplace): + super(aten_hardsigmoid, self).__init__() + self.inplace = inplace + + def forward(self, x): + return F.hardsigmoid(x, self.inplace), x + + ref_net = None + + return aten_hardsigmoid(inplace), ref_net, "aten::hardsigmoid" if not inplace else "aten::hardsigmoid_" + + @pytest.mark.nightly + @pytest.mark.precommit + @pytest.mark.parametrize("shape", [[1, 10], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5]]) + @pytest.mark.parametrize("dtype", ["float32", "float64"]) + @pytest.mark.parametrize("inplace", [True, False]) + def test_hardsigmoid(self, shape, dtype, inplace, ie_device, precision, ir_version): + self._test(*self.create_model(inplace), ie_device, precision, ir_version, kwargs_to_prepare_input={"shape": shape, "dtype": dtype}) \ No newline at end of file