diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp index 6654e51a31a..7eaef0efdce 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp @@ -30,11 +30,12 @@ ngraph::pass::HSigmoidDecomposition::HSigmoidDecomposition() { auto relu = std::make_shared(add); auto min_constant = ngraph::opset5::Constant::create(input_type, ngraph::Shape{}, {6.0}); auto min = register_new_node(relu, min_constant); - auto mul = std::make_shared(hsigmoid_node->input_value(0), min); + auto mul_constant = ngraph::opset5::Constant::create(input_type, ngraph::Shape{}, {(1.0/6.0)}); // const(1/6) + auto mul = std::make_shared(min, mul_constant); mul->set_friendly_name(m.get_match_root()->get_friendly_name()); ngraph::copy_runtime_info(hsigmoid_node, - {add_constant, add, relu, min_constant, min, mul}); + {add_constant, add, relu, min_constant, min, min_constant, mul}); ngraph::replace_node(m.get_match_root(), mul); return true; }; diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/hsigmoid_test.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/hsigmoid_test.cpp new file mode 100644 index 00000000000..a61c1b96d1b --- /dev/null +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/hsigmoid_test.cpp @@ -0,0 +1,194 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "ngraph_reader_tests.hpp" + +TEST_F(NGraphReaderTests, ReadHSigmoidNetwork) { + std::string model = R"V0G0N( + + + + + + + 1 + 3 + 22 + 22 + + + + + + + 1 + 3 + 22 + 22 + + + + + 1 + 3 + 22 + 22 + + + + + + + 1 + 3 + 22 + 22 + + + + + + + + + +)V0G0N"; + std::string modelV5 = R"V0G0N( + + + + + + + 1 + 3 + 22 + 22 + + + + + + + + 1 + 3 + 22 + 22 + + + + + 1 + 3 + 22 + 22 + + + + + + + + 1 + 3 + 22 + 22 + + + + + 1 + 3 + 22 + 22 + + + + + + + + 1 + 3 + 22 + 22 + + + + + 1 + 3 + 22 + 22 + + + + + + + 1 + + + + + + + + + + + 1 + 3 + 22 + 22 + + + 1 + + + + + 1 + 3 + 22 + 22 + + + + + + + + 1 + 3 + 22 + 22 + + + + + 1 + 3 + 22 + 22 + + + + + + + + + + + + + +)V0G0N"; + + compareIRs(model, modelV5, 40); +} diff --git a/inference-engine/tests/functional/inference_engine/transformations/hsigmoid_decomposition_test.cpp b/inference-engine/tests/functional/inference_engine/transformations/hsigmoid_decomposition_test.cpp index 828c8d69843..b2dfe6f5d99 100644 --- a/inference-engine/tests/functional/inference_engine/transformations/hsigmoid_decomposition_test.cpp +++ b/inference-engine/tests/functional/inference_engine/transformations/hsigmoid_decomposition_test.cpp @@ -40,7 +40,8 @@ TEST(TransformationTests, HSigmoidDecompositionTest) { auto relu = std::make_shared(add); auto min_constant = ngraph::opset5::Constant::create(ngraph::element::f32, ngraph::Shape{}, {6.0}); auto min = std::make_shared(relu, min_constant); - auto mul = std::make_shared(input, min); + auto mul_constant = ngraph::opset5::Constant::create(ngraph::element::f32, ngraph::Shape{}, {(1.0/6.0)}); // const(1/6) + auto mul = std::make_shared(min, mul_constant); f_ref = std::make_shared(ngraph::NodeVector{mul}, ngraph::ParameterVector{input}); }