class_docstr: Hexagon Device Session
  
  Parameters
  ----------
  remote_workspace : Union[str, pathlib.Path]
      Remote workspace path
  
  rpc_tracker : tuple(str, int)
      RPC tracker host and port number.
  
  rpc_server_key : str
      RPC server key on remote device.
  
  serial_number : str
      Device serial number. `simulator` used for hexagon simulator.
  
  session_name : str
      Hexagon RPC session name.
  
  remote_stack_size_bytes : int
      The stack size of the remote device, to be passed to
      tvm.contrib.hexagon.create_hexagon_session.
  
  rpc_receive_buffer_size_bytes : int
      RPC receive buffer size in bytes.
class_docstr_tok: ["Hexagon","Device","Session","Parameters","--","--","--","--","--","remote_workspace",":","Union","[","str",",","pathlib.Path","]","Remote","workspace","path","rpc_tracker",":","tuple","(","str",",","int",")","RPC","tracker","host","and","port","number",".","rpc_server_key",":","str","RPC","server","key","on","remote","device",".","serial_number",":","str","Device","serial","number",".","`","simulator","`","used","for","hexagon","simulator",".","session_name",":","str","Hexagon","RPC","session","name",".","remote_stack_size_bytes",":","int","The","stack","size","of","the","remote","device",",","to","be","passed","to","tvm.contrib.hexagon.create_hexagon_session",".","rpc_receive_buffer_size_bytes",":","int","RPC","receive","buffer","size","in","bytes","."]
docstr: Create a local GraphModule which consumes a remote libmod.
  
  The session must be established (via __enter__) prior to
  calling this function.
  
  Parameters
  ----------
  
  module : AOTExecutorFactoryModule
  
      The graph executor module to upload to the remote and load.
      This will typically be the output of `tvm.relay.build`,
      when passing `executor=Executor("aot")`.
  
  Returns
  -------
  GraphModule :
      Runtime graph module that can be used to execute the graph.
docstr_tok: ["Create","a","local","GraphModule","which","consumes","a","remote","libmod",".","The","session","must","be","established","(","via","__enter__",")","prior","to","calling","this","function",".","Parameters","--","--","--","--","--","module",":","AOTExecutorFactoryModule","The","graph","executor","module","to","upload","to","the","remote","and","load",".","This","will","typically","be","the","output","of","`","tvm.relay.build","`",",","when","passing","`","executor=Executor","(","``","aot","''",")","`",".","Returns","--","--","--","-","GraphModule",":","Runtime","graph","module","that","can","be","used","to","execute","the","graph","."]
code: def _aot_executor_from_factory(
      self,
      module: Union[str, pathlib.Path, AOTExecutorFactoryModule],
  ):
      """Create a local GraphModule which consumes a remote libmod.
  
      The session must be established (via __enter__) prior to
      calling this function.
  
      Parameters
      ----------
  
      module : AOTExecutorFactoryModule
  
          The graph executor module to upload to the remote and load.
          This will typically be the output of `tvm.relay.build`,
          when passing `executor=Executor("aot")`.
  
      Returns
      -------
      GraphModule :
          Runtime graph module that can be used to execute the graph.
  
      """
  
      hexagon_arch = set(
          target.mcpu.replace("hexagon", "")
          for target in module.target
          if "hexagon" in target.keys
      )
  
      self._set_device_type(module)
  
      for target in module.target:
          target_type = str(target).split()[0]
  
      assert hexagon_arch, "No hexagon target architecture found"
      assert (
          len(hexagon_arch) == 1
      ), f"Inconsistent hexagon architecture found, {hexagon_arch}"
      hexagon_arch = hexagon_arch.pop()
  
      with tempfile.TemporaryDirectory() as temp_dir:
          temp_dir = pathlib.Path(temp_dir)
          binary_name = "test_binary.so"
          binary_path = temp_dir / binary_name
  
          if target_type == "hexagon":
              module.export_library(
                  str(binary_path),
                  fcompile=hexagon.create_aot_shared,
                  fpack_imports=hexagon.pack_imports,
                  hexagon_arch=hexagon_arch,
              )
          elif target_type == "llvm":
              module.export_library(
                  str(binary_path),
                  fcompile=hexagon.create_shared,
                  fpack_imports=hexagon.pack_imports,
                  cc=hexagon.hexagon_clang_plus(),
              )
          else:
              raise ValueError(
                  "Incorrect Target kind.\n"
                  "Target kind should be from these options: [hexagon, llvm]."
              )
  
          remote_file_path = self.upload(binary_path, binary_name)
  
      return self.get_aot_executor(remote_file_path)
  
imports: import os
  import pathlib
  import tempfile
  from typing import Union
  import tvm
  from tvm import rpc
  import tvm.contrib.hexagon
  from tvm.relay.backend.executor_factory import ExecutorFactoryModule, AOTExecutorFactoryModule, GraphExecutorFactoryModule
  from .tools import export_module, HEXAGON_SIMULATOR_NAME
label_desc: Use image node_id 15 for calling the Session obj's underlying member method code with example usage: obj._aot_executor_from_factory(module) and returns: self