fluid_to_data_flow_graph_pass.h 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License. */

/*
 * This file implements the transformation from data flow graph to fluid
 * ProgramDesc.
 */

#pragma once

22 23
#include <string>

24
#include "paddle/fluid/framework/program_desc.h"
X
Xin Pan 已提交
25
#include "paddle/fluid/inference/analysis/analysis_pass.h"
26 27 28 29 30 31 32
#include "paddle/fluid/inference/analysis/data_flow_graph.h"

namespace paddle {
namespace inference {
namespace analysis {

/*
S
Superjomn 已提交
33
 * Transform a FluidDesc to a SSA.
34 35 36
 */
class FluidToDataFlowGraphPass final : public DataFlowGraphPass {
 public:
Y
Yan Chunwei 已提交
37 38 39
  FluidToDataFlowGraphPass() = default;

  bool Initialize(Argument *argument) override;
40 41 42 43
  bool Finalize() override;

  void Run(DataFlowGraph *graph) override;

Y
Yan Chunwei 已提交
44 45 46 47 48
  std::string repr() const override { return "fluid-to-data-flow-graph"; }
  std::string description() const override {
    return "transform a fluid ProgramDesc to a data flow graph.";
  }

X
Xin Pan 已提交
49
  AnalysisPass *CreateGraphvizDebugerPass() const override;
50 51 52 53 54 55 56 57

 private:
  framework::proto::ProgramDesc const *desc_;
};

}  // namespace analysis
}  // namespace inference
}  // namespace paddle