• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2022 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_CCSRC_BACKEND_OPTIMIZER_ASCEND_IR_FUSION_ADAPTIVE_MAX_POOL2D_FUSION_H_
18 #define MINDSPORE_CCSRC_BACKEND_OPTIMIZER_ASCEND_IR_FUSION_ADAPTIVE_MAX_POOL2D_FUSION_H_
19 
20 #include <string>
21 #include "ir/anf.h"
22 #include "include/backend/optimizer/pattern_engine.h"
23 #include "include/backend/optimizer/helper.h"
24 #include "include/backend/optimizer/optimizer.h"
25 
26 namespace mindspore {
27 namespace opt {
28 class AdaptiveMaxPool2DFusion : public PatternProcessPass {
29  public:
30   explicit AdaptiveMaxPool2DFusion(const std::string &name = "adaptive_max_pool2d_fusion", bool multigraph = true)
PatternProcessPass(name,multigraph)31       : PatternProcessPass(name, multigraph) {}
32   ~AdaptiveMaxPool2DFusion() override = default;
33   const BaseRef DefinePattern() const override;
34   const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override;
35 };
36 
37 class AdaptiveMaxPool2DGeFusion : public AdaptiveMaxPool2DFusion {
38  public:
39   explicit AdaptiveMaxPool2DGeFusion(bool multigraph = true)
40       : AdaptiveMaxPool2DFusion("adaptive_max_pool2d_ge_fusion", multigraph) {}
41   ~AdaptiveMaxPool2DGeFusion() override = default;
42   const BaseRef DefinePattern() const override;
43 };
44 }  // namespace opt
45 }  // namespace mindspore
46 
47 #endif  // MINDSPORE_CCSRC_BACKEND_OPTIMIZER_ASCEND_IR_FUSION_ADAPTIVE_MAX_POOL2D_FUSION_H_
48