code: def wrap_dataloader(
      dataloader, enable_async_gpu_copy: bool, device: torch.device
  ):
      """
      If the targeted device is CUDA, set up async device copy:
          - makes sure that samples are on device
          - overlap the copy with the previous batch computation.
      """
      if device.type == "cuda":
          if enable_async_gpu_copy:
              logging.info(
                  "Wrapping the dataloader to async device copies"
              )  # NOQA
              dataloader = DataloaderAsyncGPUWrapper(dataloader)
          else:
              logging.info(
                  "Wrapping the dataloader to synchronous device copies"
              )  # NOQA
              dataloader = DataloaderSyncGPUWrapper(dataloader)
      else:
          logging.warning("Selecting a CPU device")
  
      return dataloader
  
imports: import logging
  import random
  import numpy
  import torch
  import torch.distributed
  from classy_vision.dataset import DataloaderAsyncGPUWrapper
  from torch.utils.data import DataLoader
  from vissl.data.airstore_dataset import AirstoreDataset
  from vissl.data.collators import get_collator
  from vissl.data.data_helper import ClassPowerlawSampler, DeterministicDistributedSampler, StatefulDistributedSampler, StratifiedClassSampler
  from vissl.data.dataloader_sync_gpu_wrapper import DataloaderSyncGPUWrapper
  from vissl.data.dataset_catalog import get_data_files, register_datasets, VisslDatasetCatalog
  from vissl.data.disk_dataset import DiskImageDataset
  from vissl.data.ssl_dataset import GenericSSLDataset
  from vissl.data.synthetic_dataset import SyntheticImageDataset
  from vissl.data.torchvision_dataset import TorchvisionDataset
  from vissl.utils.misc import set_dataloader_seeds, setup_multiprocessing_method
label_desc: Use image node_id 8 for calling a global function with example usage: wrap_dataloader(dataloader, enable_async_gpu_copy, device) and returns: dataloader