class_docstr: Model optimized using ApacheTVM.
  
  The class cannot be directly instantiated, but implements all the core
  methods needed for using ApacheTVM at inference time.
  
  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.
      engine_path (Path, optional): Path to the serialized engine. To be used
          after loading the model (avoiding double engine serialization).
class_docstr_tok: ["Model","optimized","using","ApacheTVM",".","The","class","can","not","be","directly","instantiated",",","but","implements","all","the","core","methods","needed","for","using","ApacheTVM","at","inference","time",".","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",".","engine_path","(","Path",",","optional",")",":","Path","to","the","serialized","engine",".","To","be","used","after","loading","the","model","(","avoiding","double","engine","serialization",")","."]
docstr: Build the model from the runtime module (lib).
  
  Args:
      network_parameters (ModelParams): The model parameters as batch
          size, input and output sizes.
      lib (Module): Component needed for loading the ApacheTVM optimized
          model.
      target_device (str): The target device. Either `llvm` (CPU)
          or `cuda`.
      input_names (List[str]): Names associated to the model input
          tensors.
      device (Device): The device where the model will be executed.
      input_tfms (MultiStageTransformation, optional): Transformations
          to be performed to the model's input tensors in order to
          get the prediction.
      input_data (DataManager, optional): User defined data.
code: def from_runtime_module(
      cls,
      network_parameters: ModelParams,
      lib: ExecutorFactoryModule,
      target_device: str,
      input_names: List[str],
      device: Device,
      input_tfms: MultiStageTransformation = None,
      input_data: DataManager = None,
  ):
      """Build the model from the runtime module (lib).
  
      Args:
          network_parameters (ModelParams): The model parameters as batch
              size, input and output sizes.
          lib (Module): Component needed for loading the ApacheTVM optimized
              model.
          target_device (str): The target device. Either `llvm` (CPU)
              or `cuda`.
          input_names (List[str]): Names associated to the model input
              tensors.
          device (Device): The device where the model will be executed.
          input_tfms (MultiStageTransformation, optional): Transformations
              to be performed to the model's input tensors in order to
              get the prediction.
          input_data (DataManager, optional): User defined data.
      """
      dev = tvm.device(str(target_device), 0)
      graph_executor_module = GraphModule(lib["default"](dev))
      return cls(
          input_tfms=input_tfms,
          network_parameters=network_parameters,
          graph_executor_module=graph_executor_module,
          input_names=input_names,
          lib=lib,
          target=target_device,
          input_data=input_data,
          device=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 8 for calling the ApacheTVMInferenceLearner obj's underlying member method code with example usage: obj.from_runtime_module(cls, network_parameters, lib, target_device, input_names, device, input_tfms, input_data) and returns: cls