Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 38e8429

Browse files
Add parse_defs to return all the TC function names in a TC string
This will help make user-facing integration significantly nicer in the upcoming python API.
1 parent e8a7e04 commit 38e8429

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tensor_comprehensions/pybinds/tclib.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,15 @@ PYBIND11_MODULE(tclib, m) {
434434
});
435435
m.def("dump_cuda", [](bool dump_cuda) { tc::FLAGS_dump_cuda = dump_cuda; });
436436

437+
// Access the names of the defs in a TC string
438+
m.def("parse_defs", [](const std::string& tc) {
439+
std::vector<std::string> res;
440+
for (auto kvp : tc::detail::parse(tc)) {
441+
res.push_back(kvp.first);
442+
}
443+
return res;
444+
});
445+
437446
py::class_<TcExecutor>(m, "TcExecutor", py::module_local())
438447
.def("run", &TcExecutor::run)
439448
.def("unchecked_run", &TcExecutor::uncheckedRun);

0 commit comments

Comments
 (0)