class_docstr: A list of Events (for pretty printing).
class_docstr_tok: ["A","list","of","Events","(","for","pretty","printing",")","."]
code: def export_stacks(self, path: str, metric: str):
      if metric not in self.supported_export_stacks_metrics():
          raise ValueError(
              "metric should be one of: "
              + str(self.supported_export_stacks_metrics())
          )
      translate_table = str.maketrans(" ;\t\n", "____")
      with open(path, "w") as f:
          for evt in self:
              if evt.stack and len(evt.stack) > 0:
                  metric_value = getattr(evt, metric)
                  if int(metric_value) > 0:
                      stack_str = ""
                      for entry in reversed(evt.stack):
                          stack_str += entry.translate(translate_table)
                          stack_str += ";"
                      stack_str = (
                          stack_str[:-1] + " " + str(int(metric_value))
                      )
                      f.write(stack_str + "\n")
  
imports: import bisect
  import itertools
  import math
  from collections import defaultdict, namedtuple
  from operator import attrgetter
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from torch.autograd import DeviceType
label_desc: Use image node_id 11 for calling the EventList obj's underlying member method code with example usage: obj.export_stacks(path, metric) without return types