code: def device_mapping(cuda_device):
      """
      In order to `torch.load()` a GPU-trained model onto a CPU (or specific GPU),
      you have to supply a `map_location` function. Call this with
      the desired `cuda_device` to get the function that `torch.load()` needs.
      """
  
      def inner_device_mapping(
          storage, location
      ):  # pylint: disable=unused-argument
          if cuda_device >= 0:
              return storage.cuda(cuda_device)
          else:
              return storage
  
      return inner_device_mapping
  
imports: from __future__ import division
  from __future__ import absolute_import
  from collections import defaultdict
  import logging
  import math
  import torch
  from allennlp.common.checks import ConfigurationError
label_desc: Use image node_id 19 for calling a global function with example usage: device_mapping(cuda_device) and returns: inner_device_mapping, storage, storage