shuffle_channels_fusion.hpp
1 // Copyright (C) 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/pass/graph_rewrite.hpp>
13 
14 namespace ngraph {
15 namespace pass {
16 
17  class TRANSFORMATIONS_API ShuffleChannelsFusion;
18 
19 } // namespace pass
20 } // namespace ngraph
21 
22 /**
23  * @ingroup ie_transformation_common_api
24  * @brief ShuffleChannelsFusion transformation detects Reshape-Transpose-Reshape pattern
25  * and tries to fuse it into a single ShuffleChannels layer with axis = 1.
26  *
27  * x' = reshape(x, [N, group, C / group, H, W]) or reshape(x, [N, group, C / group, H * W])
28  * x'' = transpose(x', [0, 2, 1, 3, 4]) or transpose(x', [0, 2, 1, 3])
29  * y = reshape(x'', [N, C, H, W])
30  *
31  * @param reshape_constants_check the flag that defines the need for additional checks of reshapes constant
32  * Additional checks are required when ShuffleChannelsFusion using inside offline transformations
33  * and are not necessary when ShuffleChannelsFusion using inside CommonOptimizations
34  */
35 
36 class ngraph::pass::ShuffleChannelsFusion : public ngraph::pass::MatcherPass {
37 public:
38  NGRAPH_RTTI_DECLARATION;
39  ShuffleChannelsFusion(const bool reshape_constants_check);
40 };
ShuffleChannelsFusion transformation detects Reshape-Transpose-Reshape pattern and tries to fuse it i...
Definition: shuffle_channels_fusion.hpp:36
ngraph namespace
Definition: add_fake_quantize_fusion.hpp:14