Skip to content

Commit

Permalink
[Runtime] Expose ModuleGetFunction as PackedFunc (#15623)
Browse files Browse the repository at this point in the history
This PR exposes `Module.GetFunction` as a global PackedFunc.
Previously, the only way to access this method is via TVM's
C API, but the C++ PackedFunc API is missing. This PR patches
this issue.
  • Loading branch information
junrushao committed Aug 27, 2023
1 parent d8195e9 commit bebf590
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ TVM_REGISTER_GLOBAL("runtime.ModuleGetFormat").set_body_typed([](Module mod) {
});

TVM_REGISTER_GLOBAL("runtime.ModuleLoadFromFile").set_body_typed(Module::LoadFromFile);
TVM_REGISTER_GLOBAL("runtime.ModuleGetFunction")
.set_body_typed([](Module mod, String name, bool query_imports) {
return mod->GetFunction(name, query_imports);
});

TVM_REGISTER_GLOBAL("runtime.ModuleSaveToFile")
.set_body_typed([](Module mod, String name, tvm::String fmt) { mod->SaveToFile(name, fmt); });
Expand Down

0 comments on commit bebf590

Please sign in to comment.