xref: /aosp_15_r20/external/pytorch/torch/utils/cpp_backtrace.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# mypy: allow-untyped-defs
2from torch._C import _get_cpp_backtrace
3
4def get_cpp_backtrace(frames_to_skip=0, maximum_number_of_frames=64) -> str:
5    r"""
6    Return a string containing the C++ stack trace of the current thread.
7
8    Args:
9        frames_to_skip (int): the number of frames to skip from the top of the stack
10        maximum_number_of_frames (int): the maximum number of frames to return
11    """
12    return _get_cpp_backtrace(frames_to_skip, maximum_number_of_frames)
13