docstr: Get Nvidia GPU stats, check that values are populated.
docstr_tok: ["Get","Nvidia","GPU","stats",",","check","that","values","are","populated","."]
code: def test_get_gpu_stats(self) -> None:
      """Get Nvidia GPU stats, check that values are populated."""
      device = torch.device("cuda:0")
  
      with mock.patch("shutil.which"), mock.patch(
          "torchtnt.utils.device.subprocess.run"
      ) as subprocess_run_mock:
          subprocess_run_mock.return_value.stdout = (
              "0, 0, 0, 2, 16273, 38, 15"
          )
          gpu_stats = get_nvidia_smi_gpu_stats(device)
  
      # Check that percentages are between 0 and 100
      self.assertGreaterEqual(gpu_stats["utilization_gpu_percent"], 0)
      self.assertLessEqual(gpu_stats["utilization_gpu_percent"], 100)
      self.assertGreaterEqual(
          gpu_stats["utilization_memory_percent"], 0
      )
      self.assertLessEqual(gpu_stats["utilization_memory_percent"], 100)
      self.assertGreaterEqual(gpu_stats["fan_speed_percent"], 0)
      self.assertLessEqual(gpu_stats["fan_speed_percent"], 100)
  
      # Check that values are greater than zero
      self.assertGreaterEqual(gpu_stats["memory_used_mb"], 0)
      self.assertGreaterEqual(gpu_stats["memory_free_mb"], 0)
      self.assertGreaterEqual(gpu_stats["temperature_gpu_celsius"], 0)
      self.assertGreaterEqual(
          gpu_stats["temperature_memory_celsius"], 0
      )
  
imports: import dataclasses
  import os
  import unittest
  from collections import defaultdict, namedtuple
  from dataclasses import dataclass
  from typing import Any, Dict
  from unittest import mock
  from unittest.mock import patch
  import torch
  from torchtnt.utils.device import copy_data_to_device, get_device_from_env, get_nvidia_smi_gpu_stats, get_psutil_cpu_stats, record_data_in_stream, set_float32_precision
label_desc: Use image node_id 13 for calling the DeviceTest obj's underlying member method code with example usage: obj.test_get_gpu_stats() without return types