[LPT] integration: issue #42391 & issue #43001 (#3201)
[platform/upstream/dldt.git] / inference-engine / tests / ngraph_functions / src / low_precision_transformations / round_function.cpp
1 // Copyright (C) 2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #include "ngraph_functions/low_precision_transformations/round_function.hpp"
6
7 #include <ngraph/opsets/opset1.hpp>
8 #include "ngraph_functions/subgraph_builders.hpp"
9 #include "ngraph_functions/low_precision_transformations/common/builders.hpp"
10
11 using namespace ngraph::pass::low_precision;
12
13 namespace ngraph {
14 namespace builder {
15 namespace subgraph {
16     std::shared_ptr<ngraph::Function> RoundWithToleranceFunction::getOriginal(
17         const ngraph::element::Type precision,
18         const ngraph::Shape& inputShape,
19         const ngraph::builder::subgraph::DequantizationOperations dequantization) {
20         const auto input = std::make_shared<ngraph::op::v0::Parameter>(precision, inputShape);
21         input->set_friendly_name("input");
22
23         const auto deq = makeDequantization(input, dequantization);
24         deq->set_friendly_name("output");
25
26         const auto result = std::make_shared<ngraph::opset1::Result>(deq);
27         result->set_friendly_name("result");
28
29         return std::make_shared<ngraph::Function>(
30             ngraph::ResultVector{ result },
31             ngraph::ParameterVector{ input },
32             "RoundWithToleranceFunction");
33     }
34
35     std::shared_ptr<ngraph::Function> RoundWithToleranceFunction::getReference(
36         const ngraph::element::Type precision,
37         const ngraph::Shape& inputShape,
38         const ngraph::builder::subgraph::DequantizationOperations dequantization) {
39         const auto input = std::make_shared<ngraph::op::v0::Parameter>(precision, inputShape);
40         input->set_friendly_name("input");
41
42         const auto deq = makeDequantization(input, dequantization);
43         deq->set_friendly_name("output");
44
45         const auto result = std::make_shared<ngraph::opset1::Result>(deq);
46         result->set_friendly_name("result");
47
48         return std::make_shared<ngraph::Function>(
49             ngraph::ResultVector{ result },
50             ngraph::ParameterVector{ input },
51             "RoundWithToleranceFunction");
52     }
53
54 }  // namespace subgraph
55 }  // namespace builder
56 }  // namespace ngraph