code: def report_time(
      events: object, verbose=False, upper_control_limit=False
  ):
      """Summary reporting of total time - see: torch.autograd.profiler_util"""
      # Aggregate CPU & CUDA time.
      """
      if isinstance(events, FunctionEvent):
          function_events = events
      elif
      """
      if isinstance(events, profiler.profile):
          function_events = events.events()
      elif hasattr(
          events, "profiler"
      ):  # assumes speechbrain.core.Brain
          function_events = events.profiler.events()
      else:
          raise TypeError(
              "Expected a FunctionEvent; profiler.profile, or a SpeechBrain."
          )
  
      if upper_control_limit:
          # discerns top-level event (among others) aten:zeros which is in the avg range of 10-20ms on laptop CPU
          cpu_data = np.array(
              [
                  e.cpu_time
                  for e in function_events
                  if e.key == "ProfilerStep*"
              ]
          )
          cuda_data = np.array(
              [
                  e.cuda_time
                  for e in function_events
                  if e.key == "ProfilerStep*"
              ]
          )
          cpu_time = cpu_data.mean() + 3 * cpu_data.std()
          cuda_time = cuda_data.mean() + 3 * cuda_data.std()
      else:
          total = function_events.total_average()
          cpu_time = total.self_cpu_time_total
          cuda_time = total.self_cuda_time_total
  
      """
      if verbose:
          print("CPU time: {}".format(_format_time(cpu_time)))
          if cuda_time > 0:
              print("CUDA time: {}".format(_format_time(cuda_time)))
      """
  
      return cpu_time, cuda_time
  
file_path: speechbrain/speechbrain/utils/profiling.py
imports: import numpy
  from copy import deepcopy
  from torch import profiler
  from functools import wraps
  from typing import Any, Callable, Iterable, Optional
label_desc: Use image node_id 10 for calling a global function with example usage: report_time(events, verbose, upper_control_limit) and returns: cpu_time,  cuda_time