• 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_GRADIENT_ELIMINATE_H_
18 #define MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_IRPASS_GRADIENT_ELIMINATE_H_
19 
20 #include <vector>
21 #include <algorithm>
22 #include <memory>
23 
24 #include "frontend/optimizer/optimizer.h"
25 #include "frontend/optimizer/irpass.h"
26 #include "frontend/optimizer/anf_visitor.h"
27 #include "utils/ms_utils.h"
28 #include "frontend/operator/ops.h"
29 #include "frontend/optimizer/ad/grad.h"
30 
31 namespace mindspore {
32 namespace opt {
33 namespace irpass {
34 // {prim::kPrimJ, C}
35 class ExpandJPrim {
36  public:
37   ExpandJPrim() = default;
38   virtual ~ExpandJPrim() = default;
39   bool operator()(const FuncGraphPtr &func_graph, const OptimizerPtr &optimizer);
40   void GetJPrim(const FuncGraphPtr &func_graph);
41 
42  private:
43   std::vector<CNodePtr> j_nodes_;
44 };
45 }  // namespace irpass
46 }  // namespace opt
47 }  // namespace mindspore
48 #endif  // MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_IRPASS_GRADIENT_ELIMINATE_H_
49