class_docstr: Wrap build_func to a function that can be used in measure.
  
  Note: this is a class instead of a closure so that it can be pickled when
  using multiprocessing.
  
  Parameters
  ----------
  build_func : The compilation function
      We expect fcompile to contain an attr "output_format".
  runtime : Optional[Runtime]
      The runtime to generate artifacts for
  
  Returns
  -------
  wrapped_build_func : callable
      The wrapped build function
class_docstr_tok: ["Wrap","build_func","to","a","function","that","can","be","used","in","measure",".","Note",":","this","is","a","class","instead","of","a","closure","so","that","it","can","be","pickled","when","using","multiprocessing",".","Parameters","--","--","--","--","--","build_func",":","The","compilation","function","We","expect","fcompile","to","contain","an","attr","``","output_format","''",".","runtime",":","Optional","[","Runtime","]","The","runtime","to","generate","artifacts","for","Returns","--","--","--","-","wrapped_build_func",":","callable","The","wrapped","build","function"]
docstr: Wrapped build func.
  
  Parameters
  ----------
  measure_input: MeasureInput
      The input of measurement
  
  tmp_dir: str
      The path of temporary directory to export generated library
docstr_tok: ["Wrapped","build","func",".","Parameters","--","--","--","--","--","measure_input",":","MeasureInput","The","input","of","measurement","tmp_dir",":","str","The","path","of","temporary","directory","to","export","generated","library"]
code: def __call__(self, measure_input, tmp_dir, **kwargs):
      """
      Wrapped build func.
  
      Parameters
      ----------
      measure_input: MeasureInput
          The input of measurement
  
      tmp_dir: str
          The path of temporary directory to export generated library
      """
      tic = time.time()
      try:
          filename = os.path.join(
              tmp_dir,
              f"tmp_func_{getrandbits(64):0x}.{self.build_func.output_format}",
          )
          # TODO(tvm-team) consider linline _build_func_common
          func, arg_info = _build_func_common(
              measure_input, self.runtime, **kwargs
          )
          if self.build_func.output_format == ".model-library-format":
              # Late import to preserve autoTVM with USE_MICRO OFF
              try:
                  from tvm import (
                      micro,
                  )  # pylint: disable=import-outside-toplevel
              except ImportError:
                  raise ImportError("Requires USE_MICRO")
              micro.export_model_library_format(func, filename)
          else:
              func.export_library(filename, fcompile=self.build_func)
      except Exception as e:  # pylint: disable=broad-except
          tb = traceback.format_exc()
          return BuildResult(None, None, (tb, e), time.time() - tic)
      return BuildResult(filename, arg_info, None, time.time() - tic)
  
imports: import contextlib
  import logging
  import os
  import shutil
  import tempfile
  import threading
  import time
  import traceback
  import typing
  import warnings
  from collections import namedtuple
  from random import getrandbits
  import tvm._ffi
  import tvm.ir.transform
  from tvm import nd
  from tvm import rpc
  from tvm.autotvm.env import AutotvmGlobalScope, reset_global_scope
  from tvm.contrib import ndk, stackvm, tar
  from tvm.contrib.popen_pool import PopenPoolExecutor
  from tvm.driver import build
  from tvm.error import TVMError
  from tvm.target import Target
  from ..env import AutotvmGlobalScope
  from ..task.space import InstantiationError
  from ..utils import get_const_tuple
  from .measure import Builder, MeasureErrorNo, MeasureResult, Runner
label_desc: Use image node_id 2 for calling the _WrappedBuildFunc obj's underlying member method code with example usage: obj.__call__(measure_input, tmp_dir) and returns: BuildResult, BuildResult