[PT FE]: support aten::hardsigmoid_ (#22865)
### Details: - *support aten::hardsigmoid_ (inplace variant)* enables rtmdet model from mmyolo ### Tickets: - *CVS-132283*
This commit is contained in:
parent
1ec3c5ce99
commit
04d6d3dd66
|
|
@ -428,6 +428,8 @@ const std::map<std::string, CreatorFunction> get_supported_ops_ts() {
|
|||
{"aten::gru", op::translate_gru},
|
||||
{"aten::gt", op::translate_1to1_match_2_inputs_align_types<opset10::Greater>},
|
||||
{"aten::hardsigmoid", op::quantizable_op<op::translate_1to1_match_1_inputs<opset10::HSigmoid>>},
|
||||
{"aten::hardsigmoid_",
|
||||
op::quantizable_op<op::inplace_op<op::translate_1to1_match_1_inputs<opset10::HSigmoid>>>},
|
||||
{"aten::hardswish", op::quantizable_op<op::translate_1to1_match_1_inputs<opset10::HSwish>>},
|
||||
{"aten::hardswish_", op::quantizable_op<op::inplace_op<op::translate_1to1_match_1_inputs<opset10::HSwish>>>},
|
||||
{"aten::hardtanh", op::quantizable_op<op::translate_hardtanh>},
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
Loading…
Reference in New Issue