• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 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_FRONTEND_OPTIMIZER_IRPASS_SYMBOL_RESOLVER_H_
18 #define MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_IRPASS_SYMBOL_RESOLVER_H_
19 
20 #include <string>
21 #include <memory>
22 #include <vector>
23 
24 #include "frontend/optimizer/optimizer.h"
25 #include "frontend/optimizer/optimizer_caller.h"
26 #include "frontend/optimizer/irpass.h"
27 #include "frontend/optimizer/anf_visitor.h"
28 #include "frontend/operator/ops.h"
29 #include "ir/pattern_matcher.h"
30 #include "pipeline/jit/parse/data_converter.h"
31 #include "pipeline/jit/parse/python_adapter.h"
32 #include "pipeline/jit/parse/parse_base.h"
33 
34 namespace mindspore {
35 namespace opt {
36 namespace irpass {
37 // Put GetAttr pattern and Resolve pattern together to ensure that GetAttr pattern always takes precedence over Resolve
38 // pattern. After matching GetAttr pattern, there may be new nodes that can match GetAttr pattern and Resolve pattern.
39 // The same is true for matching Resolve pattern.
40 //
41 // {prim::kPrimGetAttr, {prim::kPrimResolve, namespace, symbol}, attr}
42 // {prim::kPrimGetAttr, namespace, attr}
43 // {prim::kPrimGetAttr, bool, attr}
44 // {prim::kPrimResolve, namespace, symbol}
45 class ResolverGetAttrResolve : public OptimizerCaller {
46  public:
47   AnfNodePtr operator()(const OptimizerPtr &optimizer, const AnfNodePtr &node) override;
48 };
49 }  // namespace irpass
50 }  // namespace opt
51 }  // namespace mindspore
52 #endif  // MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_IRPASS_SYMBOL_RESOLVER_H_
53