diff --git a/src/core/tests/models/onnx/softsign.prototxt b/src/core/tests/models/onnx/softsign.prototxt new file mode 100644 index 00000000000..21db6242583 --- /dev/null +++ b/src/core/tests/models/onnx/softsign.prototxt @@ -0,0 +1,42 @@ +ir_version: 11 +producer_name: "OV ONNX Importer" +graph { + node { + input: "X" + output: "Y" + name: "node1" + op_type: "Softsign" + doc_string: "Softsign" + domain: "" + } + name: "test" + input { + name: "X" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 10 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 10 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/frontends/onnx/frontend/src/op/softsign.cpp b/src/frontends/onnx/frontend/src/op/softsign.cpp index 868cee74310..c58c3b97b92 100644 --- a/src/frontends/onnx/frontend/src/op/softsign.cpp +++ b/src/frontends/onnx/frontend/src/op/softsign.cpp @@ -8,6 +8,7 @@ #include #include "default_opset.hpp" +#include "ngraph/opsets/opset9.hpp" #include "ngraph/shape.hpp" namespace ngraph { @@ -15,19 +16,9 @@ namespace onnx_import { namespace op { namespace set_1 { OutputVector softsign(const Node& node) { - auto data = node.get_ng_inputs().at(0); - - std::shared_ptr one_node = default_opset::Constant::create(data.get_element_type(), Shape{}, {1}); - auto abs_data = std::make_shared(data); - auto data_plus_one_node = std::make_shared(abs_data, one_node); - - return {std::make_shared(data, data_plus_one_node)}; + return {std::make_shared(node.get_ng_inputs().at(0))}; } - } // namespace set_1 - } // namespace op - } // namespace onnx_import - } // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/op/softsign.hpp b/src/frontends/onnx/frontend/src/op/softsign.hpp index f1a13c1094f..49556412f44 100644 --- a/src/frontends/onnx/frontend/src/op/softsign.hpp +++ b/src/frontends/onnx/frontend/src/op/softsign.hpp @@ -14,9 +14,6 @@ namespace set_1 { OutputVector softsign(const Node& node); } // namespace set_1 - } // namespace op - } // namespace onnx_import - } // namespace ngraph diff --git a/src/frontends/tests/onnx/onnx_import.in.cpp b/src/frontends/tests/onnx/onnx_import.in.cpp index 94e72d7d68b..3eaec85eed1 100644 --- a/src/frontends/tests/onnx/onnx_import.in.cpp +++ b/src/frontends/tests/onnx/onnx_import.in.cpp @@ -5140,3 +5140,17 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_scan8_ND_b4_seq_lens) { FAIL() << "Expected exception was not thrown."; } } + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_softsign) { + auto model = onnx_import::import_onnx_model(file_util::path_join(SERIALIZED_ZOO, "onnx/softsign.onnx")); + + Inputs inputs{std::vector{1.0, 0.1, 20.0, 12.0, -12.0, -0.2, 0.5, 100.0, 0.0, -1.0}}; + + std::vector + output{0.5, 0.09090909, 0.95238096, 0.9230769, -0.9230769, -0.16666666, 0.33333334, 0.990099, 0., -0.5}; + + auto test_case = test::TestCase(model, s_device); + test_case.add_multiple_inputs(inputs); + test_case.add_expected_output(output); + test_case.run(); +}