Skip to content

Commit

Permalink
[PT FE] Support aten::softplus (openvinotoolkit#21367)
Browse files Browse the repository at this point in the history
* [PT FE] Support aten::softplus

* Fix name
  • Loading branch information
mvafin authored Nov 29, 2023
1 parent 54e61ac commit b3a13af
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/frontends/pytorch/src/op_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ const std::map<std::string, CreatorFunction> get_supported_ops_ts() {
{"aten::size", op::translate_size},
{"aten::slice", op::quantizable_op<op::translate_slice>},
{"aten::softmax", op::translate_softmax},
{"aten::softplus", op::translate_1to1_match_1_inputs<opset10::SoftPlus>},
{"aten::sort", op::translate_sort},
{"aten::sqrt", op::translate_1to1_match_1_inputs_with_fp32_type_alignment<opset10::Sqrt>},
{"aten::square", op::translate_square},
Expand Down
24 changes: 24 additions & 0 deletions tests/layer_tests/pytorch_tests/test_softplus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import pytest
import torch

from pytorch_layer_test_class import PytorchLayerTest


class aten_softplus(torch.nn.Module):
def forward(self, x):
return torch.nn.functional.softplus(x)


class TestSoftplus(PytorchLayerTest):
def _prepare_input(self):
import numpy as np
return (np.random.randn(2, 4, 224, 224).astype(np.float32),)

@pytest.mark.nightly
@pytest.mark.precommit
def test_softplus(self, ie_device, precision, ir_version):
self._test(aten_softplus(), None, "aten::softplus",
ie_device, precision, ir_version)

0 comments on commit b3a13af

Please sign in to comment.