class_docstr: Base class for all export diagnostics.
  
  This class is used to represent all export diagnostics. It is a subclass of
  infra.Diagnostic, and adds additional methods to add more information to the
  diagnostic.
class_docstr_tok: ["Base","class","for","all","export","diagnostics",".","This","class","is","used","to","represent","all","export","diagnostics",".","It","is","a","subclass","of","infra.Diagnostic",",","and","adds","additional","methods","to","add","more","information","to","the","diagnostic","."]
docstr: Records the current C++ call stack in the diagnostic.
docstr_tok: ["Records","the","current","C++","call","stack","in","the","diagnostic","."]
code: def record_cpp_call_stack(self, frames_to_skip: int) -> infra.Stack:
      """Records the current C++ call stack in the diagnostic."""
      # NOTE: Cannot use `@_beartype.beartype`. It somehow erases the cpp stack frame info.
      # No need to skip this function because python frame is not recorded
      # in cpp call stack.
      stack = _cpp_call_stack(frames_to_skip=frames_to_skip)
      stack.message = "C++ call stack"
      self.with_stack(stack)
      return stack
  
imports: from __future__ import annotations
  import contextlib
  import gzip
  from collections.abc import Generator
  from typing import List, Optional
  import torch
  from torch.onnx._internal.diagnostics import infra
  from torch.onnx._internal.diagnostics.infra import formatter, sarif
  from torch.onnx._internal.diagnostics.infra.sarif import version
  from torch.utils import cpp_backtrace
label_desc: Use image node_id 2 for calling the TorchScriptOnnxExportDiagnostic obj's underlying member method code with example usage: obj.record_cpp_call_stack(frames_to_skip) and returns: stack