convert_batch_to_space.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/ops.hpp>
13 #include <ngraph/pass/graph_rewrite.hpp>
14 
15 namespace ngraph {
16 namespace pass {
17 
18 class TRANSFORMATIONS_API ConvertBatchToSpace;
19 
20 } // namespace pass
21 } // namespace ngraph
22 
23 /**
24  * @ingroup ie_transformation_common_api
25  * @brief ConvertBatchToSpace transformation decomposes BatchToSpace layer to Reshape->Transpose->Reshape->Crop.
26  *
27  * @param convert_by_elements - reduces the maximum number of dimensions that arise during the transformation
28  * if enabled. Default value: true.
29  * false - BatchToSpace decomposes to Reshape->Transpose->Reshape->Crop. During transformation, the number of
30  * tensor dimensions can be increased by length of block_shape input of BatchToSpace layer.
31  * true - BatchToSpace decomposes to N x (Reshape->Transpose->Reshape)->Crop, where N = length of block_shape input
32  * of BatchToSpace layer. During transformation, the number of tensor dimensions can be increased by 1.
33  *
34  */
35 
36 class ngraph::pass::ConvertBatchToSpace: public ngraph::pass::MatcherPass {
37 public:
38  NGRAPH_RTTI_DECLARATION;
39  explicit ConvertBatchToSpace(bool convert_by_elements = true) : MatcherPass() {
40  if (convert_by_elements)
41  convert_batch_to_space_by_elements();
42  else
43  convert_batch_to_space();
44  }
45 
46 private:
47  void convert_batch_to_space();
48  void convert_batch_to_space_by_elements();
49 };
ConvertBatchToSpace transformation decomposes BatchToSpace layer to Reshape->Transpose->Reshape->Crop...
Definition: convert_batch_to_space.hpp:36
ngraph namespace
Definition: add_fake_quantize_fusion.hpp:14