Skip to content

Commit

Permalink
feat(//core/compiler): Multiple outputs supported now via tuple
Browse files Browse the repository at this point in the history
Signed-off-by: Naren Dasan <[email protected]>
Signed-off-by: Naren Dasan <[email protected]>
  • Loading branch information
narendasan committed May 23, 2020
1 parent 60f2d18 commit f9af574
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ void AddEngineToGraph(torch::jit::script::Module mod, std::shared_ptr<torch::jit
auto engine_node = g->create(c10::Symbol::fromQualString("trt::execute_engine"), torch::jit::ArrayRef<torch::jit::Value*>(engine_inputs), num_io.second);
g->block()->appendNode(engine_node);

for (auto o : engine_node->outputs()) {
g->registerOutput(o);
if (engine_node->outputs().size() > 1) {
auto return_tuple_node = g->createTuple(engine_node->outputs());
g->block()->appendNode(return_tuple_node);
g->registerOutput(return_tuple_node->outputs()[0]);
} else {
g->registerOutput(engine_node->outputs()[0]);
}

LOG_DEBUG(*g << "(AddEngineToGraph)\n");
Expand Down

0 comments on commit f9af574

Please sign in to comment.