Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dfg graphviz pass #11211

Merged
merged 2 commits into from
Jun 6, 2018
Merged

Conversation

Superjomn
Copy link
Contributor

@Superjomn Superjomn commented Jun 6, 2018

  • graphviz to draw a Data Flow Graph,
  • helper to debug the graph structure.

@Superjomn Superjomn added the 预测 原名Inference,包含Capi预测问题等 label Jun 6, 2018
SRCS dfg_graphviz_draw_pass_tester.cc
DEPS analysis
ARGS --inference_model_dir=${PYTHON_TESTS_DIR}/book/word2vec.inference.model)
set_tests_properties(test_dfg_graphviz_draw_pass PROPERTIES DEPENDS test_word2vec)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请问analysis目录下的单侧为什么要依赖test_word2vec的模型目录呢?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_word2vec 生成model

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 需要word2vec model的programdesc来进行分析,加下注释。
  • 需要加一个function,减少CMake这里的代码。

std::string Draw(DataFlowGraph* graph) { return graph->DotString(); }

std::string dir_;
std::string id_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请多加点注释。dir是目录名,id是文件名?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下个pr再加吧

bool Finalize() override { return Pass::Finalize(); }

Pass* CreatePrinterPass(std::ostream& os,
const std::string& banner) const override {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请问这个函数的功能是什么呢,参数banner是指?我看单侧里也没有用到这个函数。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass.Run(&dfg);

// test content
std::ifstream file("./graph_test.dot");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

输入文件graph_test.dot是已经存在了?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面的 Run 会生成

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请加注释说明下这个输入文件的来源。

while (std::getline(file, line)) {
no++;
}
ASSERT_EQ(no, 82);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

验证有82行就可以了?82这个数字是从哪儿来的?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对,验证内容没太大必要

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请加注释说明下82行的来源,不过如果programdesc发生变化了,这里会不会就过不了了。

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM。一些问题在下一个PR中修改。

SRCS dfg_graphviz_draw_pass_tester.cc
DEPS analysis
ARGS --inference_model_dir=${PYTHON_TESTS_DIR}/book/word2vec.inference.model)
set_tests_properties(test_dfg_graphviz_draw_pass PROPERTIES DEPENDS test_word2vec)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 需要word2vec model的programdesc来进行分析,加下注释。
  • 需要加一个function,减少CMake这里的代码。

pass.Run(&dfg);

// test content
std::ifstream file("./graph_test.dot");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请加注释说明下这个输入文件的来源。

while (std::getline(file, line)) {
no++;
}
ASSERT_EQ(no, 82);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请加注释说明下82行的来源,不过如果programdesc发生变化了,这里会不会就过不了了。

@Superjomn Superjomn merged commit df87e63 into PaddlePaddle:develop Jun 6, 2018
@Superjomn Superjomn deleted the feature/dot-debug-pass branch June 6, 2018 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
预测 原名Inference,包含Capi预测问题等
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants