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