code: def model_device(model):
      """Determine the device the model is allocated on."""
      # Source: https://discuss.pytorch.org/t/how-to-check-if-model-is-on-cuda/180
      try:
          return str(next(model.parameters()).device)
      except StopIteration:
          # Model has no parameters
          pass
      return "cpu"
  
imports: import argparse
  from collections import OrderedDict
  from copy import deepcopy
  import logging
  import operator
  import random
  import numpy
  import torch
  import torch.nn
  import torch.backends.cudnn
  import yaml
  import inspect
label_desc: Use image node_id 1 for calling a global function with example usage: model_device(model) and returns: str, str