transpose_sinking.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 TransposeSinking;
20 class TRANSFORMATIONS_API TransposeReduction;
21 class TRANSFORMATIONS_API TransposeFQReduction;
22 class TRANSFORMATIONS_API TransposeFuse;
23 
24 } // namespace pass
25 } // namespace ngraph
26 
27 /**
28  * @ingroup ie_transformation_common_api
29  * @brief TransposeReduction transformation sinks Transpose through Reduce operations
30  */
31 class ngraph::pass::TransposeReduction : public ngraph::pass::MatcherPass {
32 public:
33  NGRAPH_RTTI_DECLARATION;
35 };
36 
37 /**
38  * @ingroup ie_transformation_common_api
39  * @brief TransposeFQReduction transformation sinks Transpose through FakeQuantize in case it is followed by reduction or squeeze
40  */
41 class ngraph::pass::TransposeFQReduction : public ngraph::pass::MatcherPass {
42 public:
43  NGRAPH_RTTI_DECLARATION;
45 };
46 
47 /**
48  * @ingroup ie_transformation_common_api
49  * @brief TransposeFuse transformation eliminates 2 consequtive Transposes if they result in no changes to input or fuses them
50  * to single Transpose if input gets changed
51  */
52 class ngraph::pass::TransposeFuse : public ngraph::pass::MatcherPass {
53 public:
54  NGRAPH_RTTI_DECLARATION;
55  TransposeFuse();
56 };
57 
58 /**
59  * @ingroup ie_transformation_common_api
60  * @brief TransposeSinking transformation sinks Transposes through known operations
61  */
62 class ngraph::pass::TransposeSinking: public ngraph::pass::GraphRewrite {
63 public:
64  NGRAPH_RTTI_DECLARATION;
66  add_matcher<ngraph::pass::TransposeFQReduction>();
67  add_matcher<ngraph::pass::TransposeReduction>();
68  add_matcher<ngraph::pass::TransposeFuse>();
69  }
70 };
TransposeFQReduction transformation sinks Transpose through FakeQuantize in case it is followed by re...
Definition: transpose_sinking.hpp:41
TransposeFuse transformation eliminates 2 consequtive Transposes if they result in no changes to inpu...
Definition: transpose_sinking.hpp:52
TransposeReduction transformation sinks Transpose through Reduce operations.
Definition: transpose_sinking.hpp:31
TransposeSinking transformation sinks Transposes through known operations.
Definition: transpose_sinking.hpp:62
ngraph namespace
Definition: add_fake_quantize_fusion.hpp:14