code: def multi_device(test_method):
      """
      Decorator that provides an argument `device` of type `str` to a test function.
  
      If you have a CUDA capable GPU available, device will be "cuda:0", otherwise the device will
      be "cpu".
  
      !!! Note
          If you have a CUDA capable GPU available, but you want to run the test using CPU only,
          just set the environment variable "CUDA_CAPABLE_DEVICES=''" before running pytest.
      """
      return pytest.mark.parametrize("device", _available_devices)(
          pytest.mark.gpu(test_method)
      )
  
file_path: allennlp/allennlp/common/testing/__init__.py
imports: from typing import Dict, Any, Optional, Union, Tuple, List
  import torch
  from torch.testing import assert_allclose
  import pytest
  from allennlp.common.testing.test_case import AllenNlpTestCase
  from allennlp.common.testing.model_test_case import ModelTestCase
  from allennlp.common.testing.distributed_test import run_distributed_test
  from allennlp.modules.transformer import TransformerModule
  from allennlp.training.metrics import Metric
label_desc: Use image node_id 1 for calling a global function with example usage: multi_device(test_method) and returns: pytest