Skip to content

Commit f9af574

Browse files
committed
feat(//core/compiler): Multiple outputs supported now via tuple
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 60f2d18 commit f9af574

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: core/compiler.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ void AddEngineToGraph(torch::jit::script::Module mod, std::shared_ptr<torch::jit
6060
auto engine_node = g->create(c10::Symbol::fromQualString("trt::execute_engine"), torch::jit::ArrayRef<torch::jit::Value*>(engine_inputs), num_io.second);
6161
g->block()->appendNode(engine_node);
6262

63-
for (auto o : engine_node->outputs()) {
64-
g->registerOutput(o);
63+
if (engine_node->outputs().size() > 1) {
64+
auto return_tuple_node = g->createTuple(engine_node->outputs());
65+
g->block()->appendNode(return_tuple_node);
66+
g->registerOutput(return_tuple_node->outputs()[0]);
67+
} else {
68+
g->registerOutput(engine_node->outputs()[0]);
6569
}
6670

6771
LOG_DEBUG(*g << "(AddEngineToGraph)\n");

0 commit comments

Comments
 (0)