code: def num_cuda_devices() -> int:
      """Returns the number of available CUDA devices.
  
      Unlike :func:`torch.cuda.device_count`, this function does its best not to create a CUDA context for fork support,
      if the platform allows it.
  
      """
      if _TORCH_GREATER_EQUAL_2_0:
          return torch.cuda.device_count()
  
      # Implementation copied from upstream: https://github.com/pytorch/pytorch/pull/84879
      # TODO: Remove once minimum supported PyTorch version is 2.0
      nvml_count = _device_count_nvml()
      return torch.cuda.device_count() if nvml_count < 0 else nvml_count
  
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 4 for calling a global function with example usage: num_cuda_devices() and returns: unknown, torch