code: def get_memory_details(kineto_event: _KinetoEvent) -> Tuple[str, int]:
      """Get device name and number of bytes (de)allocated during an event.
  
      :param kineto_event: a Kineto event instance.
      """
      if kineto_event.device_type() in [
          DeviceType.CPU,
          DeviceType.MKLDNN,
          DeviceType.IDEEP,
      ]:
          return "cpu", kineto_event.nbytes()
      elif kineto_event.device_type() in [
          DeviceType.CUDA,
          DeviceType.HIP,
      ]:
          return (
              f"cuda_{kineto_event.device_index()}",
              kineto_event.nbytes(),
          )
      else:
          raise ValueError(
              f"Device {kineto_event.device_type()} is not valid."
          )
  
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 2 for calling a global function with example usage: get_memory_details(kineto_event) and returns: str,  kineto_event, str, kineto_event,  kineto_event