-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Closed
Labels
high prioritymodule: autogradRelated to torch.autograd, and the autograd engine in generalRelated to torch.autograd, and the autograd engine in generalmodule: docsRelated to our documentation, both in docs/ and docblocksRelated to our documentation, both in docs/ and docblockssmallWe think this is a small issue to fix. Consider knocking off high priority small issuesWe think this is a small issue to fix. Consider knocking off high priority small issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🚀 Feature
torch.autograd.profiler.profile().export_chrome_trace
is great. Adding information to it from Python would make it even better.
Motivation
In multi-threaded PyTorch code, it can be useful to further annotate the tracing output by adding additional information to it.
Pitch
One easy / cheap way of doing this:
PYBIND11_MODULE(torch, m) {
py::class_<torch::autograd::profiler::RecordFunction>(m, "Record")
.def(py::init<std::string>(), py::arg("name"));
}
And then in Python
record = torch.Record("model")
outputs = model(frame)
del record # Alternatively, turn it into a context manager.
Metadata
Metadata
Assignees
Labels
high prioritymodule: autogradRelated to torch.autograd, and the autograd engine in generalRelated to torch.autograd, and the autograd engine in generalmodule: docsRelated to our documentation, both in docs/ and docblocksRelated to our documentation, both in docs/ and docblockssmallWe think this is a small issue to fix. Consider knocking off high priority small issuesWe think this is a small issue to fix. Consider knocking off high priority small issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module