code: def get_num_oom_events(
      kineto_event: _KinetoEvent,
      out_of_memory_events: List[List[Union[_KinetoEvent, bool]]],
  ) -> int:
      oom_records_acc = profiler_util.MemRecordsAcc(
          out_of_memory_events
      )
      records_in_interval = oom_records_acc.in_interval(
          kineto_event.start_us(),
          kineto_event.start_us() + kineto_event.duration_us(),
      )
      return len(list(records_in_interval))
  
file_path: ludwig/ludwig/benchmarking/reporting.py
imports: from collections import Counter, defaultdict
  from statistics import mean
  from typing import Any, Dict, List, Tuple, Union
  import torch
  from torch._C._autograd import _KinetoEvent
  from torch.autograd import DeviceType, profiler_util
  from ludwig.benchmarking.profiler_dataclasses import DeviceUsageMetrics, SystemResourceMetrics, TorchProfilerMetrics
  from ludwig.constants import LUDWIG_TAG
label_desc: Use image node_id 6 for calling a global function with example usage: get_num_oom_events(kineto_event, out_of_memory_events) and returns: len