Skip to content

Commit

Permalink
(trivial) Use the exact CLI file name for single function. (pytorch#3747
Browse files Browse the repository at this point in the history
)

Summary:
**Summary**
When the module has a single function, even if the CLI parameter is given as (for example)

> -dump-graph-DAG=graph.dot

the generated file name is "_graph.dot" which is not clean (pre-pending the function name makes sense when multiple functions are in the module).

Documentation/test:
Not required.
Pull Request resolved: pytorch#3747

Differential Revision: D18376400

Pulled By: jfix71

fbshipit-source-id: 609ecbba99c9b45e7957f2cfa9e6aec8e3174258
  • Loading branch information
mciprian13 authored and facebook-github-bot committed Nov 7, 2019
1 parent 1af0432 commit 60aed13
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/loader/Loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ void Loader::compile(CompilationContext &cctx) {
for (auto function : module->getFunctions()) {
std::string filename =
function->getFilename() + "_" + dumpGraphDAGFileOpt;
if (module->getFunctions().size() == 1) {
filename = dumpGraphDAGFileOpt;
}
function->dumpDAG(filename.c_str());
}
}
Expand Down

0 comments on commit 60aed13

Please sign in to comment.