[ONNX] Extend ONNX FE with SoftSign-9 operation (#11766)
This commit is contained in:
1 parent
042bd7274a
commit
c7f8112339
4 files changed
+58
-14
No files matched your search
@@ -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
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <vector>
|
||||
|
||||
#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<ngraph::Node> one_node = default_opset::Constant::create(data.get_element_type(), Shape{}, {1});
|
||||
auto abs_data = std::make_shared<default_opset::Abs>(data);
|
||||
auto data_plus_one_node = std::make_shared<default_opset::Add>(abs_data, one_node);
|
||||
|
||||
return {std::make_shared<default_opset::Divide>(data, data_plus_one_node)};
|
||||
return {std::make_shared<ngraph::opset9::SoftSign>(node.get_ng_inputs().at(0))};
|
||||
}
|
||||
|
||||
} // namespace set_1
|
||||
|
||||
} // namespace op
|
||||
|
||||
} // namespace onnx_import
|
||||
|
||||
} // namespace ngraph
|
||||
@@ -14,9 +14,6 @@ namespace set_1 {
|
||||
OutputVector softsign(const Node& node);
|
||||
|
||||
} // namespace set_1
|
||||
|
||||
} // namespace op
|
||||
|
||||
} // namespace onnx_import
|
||||
|
||||
} // namespace ngraph
|
||||
@@ -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<float>{1.0, 0.1, 20.0, 12.0, -12.0, -0.2, 0.5, 100.0, 0.0, -1.0}};
|
||||
|
||||
std::vector<float>
|
||||
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();
|
||||
}
|
||||
Reference in new issue
Block a user