class_docstr: Accelerator for NVIDIA CUDA devices.
class_docstr_tok: ["Accelerator","for","NVIDIA","CUDA","devices","."]
docstr: Gets stats for the given GPU device.
  
  Args:
      device: GPU device for which to get stats
  
  Returns:
      A dictionary mapping the metrics to their values.
  
  Raises:
      FileNotFoundError:
          If nvidia-smi installation not found
docstr_tok: ["Gets","stats","for","the","given","GPU","device",".","Args",":","device",":","GPU","device","for","which","to","get","stats","Returns",":","A","dictionary","mapping","the","metrics","to","their","values",".","Raises",":","FileNotFoundError",":","If","nvidia-smi","installation","not","found"]
code: def get_device_stats(self, device: _DEVICE) -> Dict[str, Any]:
      """Gets stats for the given GPU device.
  
      Args:
          device: GPU device for which to get stats
  
      Returns:
          A dictionary mapping the metrics to their values.
  
      Raises:
          FileNotFoundError:
              If nvidia-smi installation not found
  
      """
      return torch.cuda.memory_stats(device)
  
imports: import logging
  import os
  import shutil
  import subprocess
  from typing import Any, Dict, List, Optional, Union
  import torch
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.accelerators import _AcceleratorRegistry
  from lightning.fabric.accelerators.cuda import _check_cuda_matmul_precision, _clear_cuda_memory, num_cuda_devices
  from lightning.fabric.utilities.device_parser import _parse_gpu_ids
  from lightning.fabric.utilities.types import _DEVICE
  from lightning.pytorch.accelerators.accelerator import Accelerator
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
label_desc: Use image node_id 4 for calling the CUDAAccelerator obj's underlying member method code with example usage: obj.get_device_stats(device) and returns: torch