class_docstr: GPU memory utilization in percent for each GPU.
class_docstr_tok: ["GPU","memory","utilization","in","percent","for","each","GPU","."]
code: def aggregate(self) -> dict:
      if not self.samples:
          return {}
      stats = {}
      device_count = pynvml.nvmlDeviceGetCount()  # type: ignore
      for i in range(device_count):
          samples = [sample[i] for sample in self.samples]
          aggregate = aggregate_mean(samples)
          stats[self.name.format(i)] = aggregate
  
          handle = pynvml.nvmlDeviceGetHandleByIndex(i)  # type: ignore
          if gpu_in_use_by_this_process(handle, self.pid):
              stats[self.name.format(f"process.{i}")] = aggregate
  
      return stats
  
imports: import logging
  import threading
  from collections import deque
  from typing import TYPE_CHECKING, List
  from wandb.vendor.pynvml import pynvml
  from .aggregators import aggregate_mean
  from .asset_registry import asset_registry
  from .interfaces import Interface, Metric, MetricsMonitor
label_desc: Use image node_id 4 for calling the GPUMemoryUtilization obj's underlying member method code with example usage: obj.aggregate() and returns: stats, dict