class_docstr: Model optimized using ApacheTVM with a Pytorch interface.
  
  This class can be used exactly in the same way as a pytorch Module object.
  At prediction time it takes as input pytorch tensors given as positional
  arguments.
  
  Attributes:
      network_parameters (ModelParams): The model parameters as batch
              size, input and output sizes.
      graph_executor_module (GraphModule): The graph executor. This is the
          central component in the ApacheTVM optimized model execution.
      input_names (List[str]): Names associated to the model input tensors.
      lib (Module): Component needed for loading the ApacheTVM optimized
          model.
      target (str): Target device. It can be wither `llvm` for targeting CPUs
          or "cuda" for targeting GPUs.
class_docstr_tok: ["Model","optimized","using","ApacheTVM","with","a","Pytorch","interface",".","This","class","can","be","used","exactly","in","the","same","way","as","a","pytorch","Module","object",".","At","prediction","time","it","takes","as","input","pytorch","tensors","given","as","positional","arguments",".","Attributes",":","network_parameters","(","ModelParams",")",":","The","model","parameters","as","batch","size",",","input","and","output","sizes",".","graph_executor_module","(","GraphModule",")",":","The","graph","executor",".","This","is","the","central","component","in","the","ApacheTVM","optimized","model","execution",".","input_names","(","List","[","str","]",")",":","Names","associated","to","the","model","input","tensors",".","lib","(","Module",")",":","Component","needed","for","loading","the","ApacheTVM","optimized","model",".","target","(","str",")",":","Target","device",".","It","can","be","wither","`","llvm","`","for","targeting","CPUs","or","``","cuda","''","for","targeting","GPUs","."]
code: def _convert_device(device: Any):
      if isinstance(device, int):
          return "cpu"
      return device
  
imports: import os
  import shutil
  from abc import ABC
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Union, Type, Dict, Any, List, Generator, Tuple, Optional
  import numpy
  from nebullvm.config import TVM_FILENAMES
  from nebullvm.core.models import Device, ModelParams, DeepLearningFramework
  from nebullvm.operations.inference_learners.base import BaseInferenceLearner, LearnerMetadata, PytorchBaseInferenceLearner, TensorflowBaseInferenceLearner, NumpyBaseInferenceLearner
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.torch import torch
  from nebullvm.optional_modules.tvm import GraphModule, tvm, ExecutorFactoryModule
  from nebullvm.tools.data import DataManager
  from nebullvm.tools.transformations import MultiStageTransformation, HalfPrecisionTransformation
label_desc: Use image node_id 2 for calling the PytorchApacheTVMInferenceLearner obj's underlying member method code with example usage: obj._convert_device(device) and returns: device, str