未验证 提交 dd3aca3b 编写于 作者: F flame 提交者: GitHub

Merge pull request #14824 from Superjomn/fix/visualizer

fix visualizer
...@@ -44,9 +44,10 @@ void IrGraphBuildPass::RunImpl(Argument *argument) { ...@@ -44,9 +44,10 @@ void IrGraphBuildPass::RunImpl(Argument *argument) {
argument->SetMainProgram(program.release()); argument->SetMainProgram(program.release());
} else if (argument->model_program_path_valid() && } else if (argument->model_program_path_valid() &&
argument->model_params_path_valid()) { argument->model_params_path_valid()) {
auto program = auto program = LoadModel(
LoadModel(argument->model_program_path(), argument->model_params_path(), argument->model_program_path(), argument->model_params_path(),
argument->scope_ptr(), place, argument->model_from_memory()); argument->scope_ptr(), place,
argument->model_from_memory_valid() && argument->model_from_memory());
argument->SetMainProgram(program.release()); argument->SetMainProgram(program.release());
} else { } else {
PADDLE_THROW( PADDLE_THROW(
......
...@@ -26,9 +26,6 @@ DEFINE_string(model_dir, "", "model directory"); ...@@ -26,9 +26,6 @@ DEFINE_string(model_dir, "", "model directory");
DEFINE_string(model_program_path, "", "model program path"); DEFINE_string(model_program_path, "", "model program path");
DEFINE_string(model_params_path, "", "model params path"); DEFINE_string(model_params_path, "", "model params path");
USE_PASS(graph_viz_pass);
USE_PASS(graph_to_program_pass);
using paddle::inference::analysis::Argument; using paddle::inference::analysis::Argument;
namespace paddle { namespace paddle {
...@@ -40,7 +37,6 @@ void Visualizer::SetArgument(Argument *argument) { argument_ = argument; } ...@@ -40,7 +37,6 @@ void Visualizer::SetArgument(Argument *argument) { argument_ = argument; }
bool Visualizer::Run() { bool Visualizer::Run() {
paddle::framework::InitDevices(false); paddle::framework::InitDevices(false);
paddle::inference::analysis::Analyzer().Run(argument_); paddle::inference::analysis::Analyzer().Run(argument_);
return true; return true;
} }
...@@ -77,7 +73,7 @@ int main(int argc, char *argv[]) { ...@@ -77,7 +73,7 @@ int main(int argc, char *argv[]) {
// Only 1 pass, default filename is 0_ir_origin.dot // Only 1 pass, default filename is 0_ir_origin.dot
// For more details, looking for paddle::inference::analysis::IRPassManager // For more details, looking for paddle::inference::analysis::IRPassManager
argument.SetIrAnalysisPasses({"graph_viz_pass"}); argument.SetIrAnalysisPasses({"infer_clean_graph_pass", "graph_viz_pass"});
std::unique_ptr<paddle::framework::Scope> scope{ std::unique_ptr<paddle::framework::Scope> scope{
new paddle::framework::Scope()}; new paddle::framework::Scope()};
...@@ -90,3 +86,7 @@ int main(int argc, char *argv[]) { ...@@ -90,3 +86,7 @@ int main(int argc, char *argv[]) {
return 0; return 0;
} }
USE_PASS(infer_clean_graph_pass);
USE_PASS(graph_viz_pass);
USE_PASS(graph_to_program_pass);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册