mvn_fusion.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <vector>
8 #include <memory>
9 
10 #include <transformations_visibility.hpp>
11 
12 #include <ngraph/ngraph.hpp>
13 #include <ngraph/pass/graph_rewrite.hpp>
14 #include "ngraph/pattern/matcher.hpp"
15 
16 namespace ngraph {
17 namespace pass {
18 
19 class TRANSFORMATIONS_API MVNFusion;
20 class TRANSFORMATIONS_API MVNFusionWithoutConstants;
21 class TRANSFORMATIONS_API MVNFusionWithConstantsInside;
22 
23 } // namespace pass
24 } // namespace ngraph
25 
26 /**
27  * @ingroup ie_transformation_common_api
28  * @brief MVNFusion transformation replaces group of
29  * operations: (x - ReduceMean(x, axes)) / (Sqrt(ReduceMean((x - ReduceMean(x, axes)) ^ 2)) + eps) to MVN op.
30  */
31 class ngraph::pass::MVNFusionWithoutConstants : public ngraph::pass::MatcherPass {
32 public:
33  NGRAPH_RTTI_DECLARATION;
35 };
36 
37 /**
38  * @ingroup ie_transformation_common_api
39  * @brief MVNFusion transformation replaces group of
40  * operations: gamma * (x - ReduceMean(x, axes)) / (Sqrt(ReduceMean((x - ReduceMean(x, axes)) ^ 2)) + eps) + beta to MVN op.
41  */
42 class ngraph::pass::MVNFusionWithConstantsInside : public ngraph::pass::MatcherPass {
43 public:
44  NGRAPH_RTTI_DECLARATION;
46 };
47 
48 /**
49  * @ingroup ie_transformation_common_api
50  * @brief MVNFusion transformation replaces various sub-graphs with a MVN op.
51  */
52 class ngraph::pass::MVNFusion: public ngraph::pass::GraphRewrite {
53 public:
54  NGRAPH_RTTI_DECLARATION;
55  MVNFusion() {
56  add_matcher<ngraph::pass::MVNFusionWithoutConstants>();
57  add_matcher<ngraph::pass::MVNFusionWithConstantsInside>();
58  }
59 };
MVNFusion transformation replaces group of operations: gamma * (x - ReduceMean(x, axes)) / (Sqrt(Redu...
Definition: mvn_fusion.hpp:42
MVNFusion transformation replaces group of operations: (x - ReduceMean(x, axes)) / (Sqrt(ReduceMean((...
Definition: mvn_fusion.hpp:31
MVNFusion transformation replaces various sub-graphs with a MVN op.
Definition: mvn_fusion.hpp:52
ngraph namespace
Definition: add_fake_quantize_fusion.hpp:14