code: def infer_device_type(
      predict_net: caffe2_pb2.NetDef,
      known_status: Dict[Tuple[str, int], Any],
      device_name_style: str = "caffe2",
  ) -> Dict[Tuple[str, int], str]:
      """Return the device type ("cpu" or "gpu"/"cuda") of each (versioned) blob"""
  
      assert device_name_style in ["caffe2", "pytorch"]
      _CPU_STR = "cpu"
      _GPU_STR = "gpu" if device_name_style == "caffe2" else "cuda"
  
      def _copy_cpu_to_gpu_updater(op, input_types, output_types):
          if input_types[0] == _GPU_STR or output_types[0] == _CPU_STR:
              _updater_raise(op, input_types, output_types)
          return ([_CPU_STR], [_GPU_STR])
  
      def _copy_gpu_to_cpu_updater(op, input_types, output_types):
          if input_types[0] == _CPU_STR or output_types[0] == _GPU_STR:
              _updater_raise(op, input_types, output_types)
          return ([_GPU_STR], [_CPU_STR])
  
      def _other_ops_updater(op, input_types, output_types):
          non_none_types = [
              x for x in input_types + output_types if x is not None
          ]
          if len(non_none_types) > 0:
              the_type = non_none_types[0]
              if not all(x == the_type for x in non_none_types):
                  _updater_raise(op, input_types, output_types)
          else:
              the_type = None
          return (
              [the_type for _ in op.input],
              [the_type for _ in op.output],
          )
  
      def _device_updater(op, *args, **kwargs):
          return {
              "CopyCPUToGPU": _copy_cpu_to_gpu_updater,
              "CopyGPUToCPU": _copy_gpu_to_cpu_updater,
          }.get(op.type, _other_ops_updater)(op, *args, **kwargs)
  
      return _generic_status_identifier(
          predict_net, _device_updater, known_status
      )
  
imports: import collections
  import copy
  import functools
  import logging
  import numpy
  import os
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  from unittest import mock
  import caffe2.python.utils
  import torch
  import torch.nn.functional
  from caffe2.proto import caffe2_pb2
  from caffe2.python import core, net_drawer, workspace
  from torch.nn.functional import interpolate
label_desc: Use image node_id 23 for calling a global function with example usage: infer_device_type(predict_net, known_status, device_name_style) and returns: _generic_status_identifier, list,  list, list,  list, unknown,  unknown, dict