class_docstr: Stats for AMD GPU devices.
code: def sample(self) -> None:
      try:
          raw_stats = get_rocm_smi_stats()
          cards = []
  
          card_keys = [
              key
              for key in sorted(raw_stats.keys())
              if key.startswith("card")
          ]
  
          for card_key in card_keys:
              card_stats = raw_stats[card_key]
              stats = self.parse_stats(card_stats)
              if stats:
                  cards.append(stats)
  
          if cards:
              self.samples.append(cards)
  
      except (
          OSError,
          ValueError,
          TypeError,
          subprocess.CalledProcessError,
      ) as e:
          logger.exception(f"GPU stats error: {e}")
  
imports: import json
  import logging
  import shutil
  import subprocess
  import sys
  import threading
  from collections import deque
  from typing import TYPE_CHECKING, Any, Dict, List, Union
  from wandb.sdk.lib import telemetry
  from .aggregators import aggregate_mean
  from .asset_registry import asset_registry
  from .interfaces import Interface, Metric, MetricsMonitor
label_desc: Use image node_id 3 for calling the GPUAMDStats obj's underlying member method code with example usage: obj.sample() without return types