xref: /aosp_15_r20/external/pytorch/torch/csrc/profiler/python/combined_traceback.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #include <torch/csrc/profiler/combined_traceback.h>
2 
3 #include <pybind11/pybind11.h>
4 #include <torch/csrc/utils/pybind.h>
5 
6 namespace torch {
7 
8 // symbolize combined traceback objects, converting them into lists of
9 // dictionaries that are easily consumed in python.
10 
11 // returns std::vector because one use is to call it with a batch of
12 // tracebacks that come from a larger datastructure (e.g. a memory snapshot)
13 // and then have more c++ code to put those objects in the right place.
14 TORCH_API std::vector<pybind11::object> py_symbolize(
15     std::vector<CapturedTraceback*>& to_symbolize);
16 
17 // requires GIL to be held, frees any pending free frames
18 void freeDeadCapturedTracebackFrames();
19 
20 void installCapturedTracebackPython();
21 
22 } // namespace torch
23