class_docstr: Accelerator for NVIDIA CUDA devices.
class_docstr_tok: ["Accelerator","for","NVIDIA","CUDA","devices","."]
docstr: Raises:
      ValueError:
          If the selected device is not of type CUDA.
docstr_tok: ["Raises",":","ValueError",":","If","the","selected","device","is","not","of","type","CUDA","."]
code: def setup_device(self, device: torch.device) -> None:
      """
      Raises:
          ValueError:
              If the selected device is not of type CUDA.
      """
      if device.type != "cuda":
          raise ValueError(
              f"Device should be CUDA, got {device} instead."
          )
      _check_cuda_matmul_precision(device)
      torch.cuda.set_device(device)
  
imports: import os
  import warnings
  from contextlib import contextmanager
  from functools import lru_cache
  from typing import Generator, List, Optional, Union, cast
  import torch
  from typing_extensions import override
  from lightning.fabric.accelerators.accelerator import Accelerator
  from lightning.fabric.accelerators.registry import _AcceleratorRegistry
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.fabric.utilities.rank_zero import rank_zero_info
label_desc: Use image node_id 1 for calling the CUDAAccelerator obj's underlying member method code with example usage: obj.setup_device(device) without return types