Class Module


public class Module extends TVMValue
Container of compiled functions of TVM.
  • Field Details

    • handle

      public final long handle
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • asModule

      public Module asModule()
      Easy for user to get the instance from returned TVMValue.
      Overrides:
      asModule in class TVMValue
      Returns:
      this
    • release

      public void release()
      Release the Module.

      We highly recommend you to do this manually since the GC strategy is lazy.

      Overrides:
      release in class TVMValue
    • entryFunc

      public Function entryFunc()
      Get the entry function.
      Returns:
      The entry function if exist
    • getFunction

      public Function getFunction(String name, boolean queryImports)
      Get function from the module.
      Parameters:
      name - The name of the function.
      queryImports - Whether also query modules imported by this module.
      Returns:
      The result function.
    • getFunction

      public Function getFunction(String name)
    • importModule

      public void importModule(Module module)
      Add module to the import list of current one.
      Parameters:
      module - The other module.
    • typeKey

      public String typeKey()
      Get type key of the module.
      Returns:
      type key of the module.
    • load

      public static Module load(String path, String fmt)
      Load module from file.
      Parameters:
      path - The path to the module file.
      fmt - The format of the file, if not specified it will be inferred from suffix of the file.
      Returns:
      The loaded module
    • load

      public static Module load(String path)
    • enabled

      public static boolean enabled(String target)
      Whether module runtime is enabled for target, e.g., The following code checks if cuda is enabled. Module.enabled("cuda")
      Parameters:
      target - The target device type.
      Returns:
      Whether runtime is enabled.