tvm_ffi.Module#
- class tvm_ffi.Module[source]#
Bases:
Object
Module container for dynamically loaded Module.
Examples
import tvm_ffi # load the module from a tvm-ffi shared library mod : tvm_ffi.Module = tvm_ffi.load_module("path/to/library.so") # you can use mod.func_name to call the exported function mod.func_name(*args)
See also
- __init__()#
Methods
__init__
()Remove all imports of the module.
get_function
(name[, query_imports])Get function from the module.
Get the runtime module property mask.
Get the format of the module.
implements_function
(name[, query_imports])Return True if the module defines a global function.
import_module
(module)Add module to the import list of current one.
inspect_source
([fmt])Get source code from module, if available.
Return whether the module is binary serializable (supports save_to_bytes).
Return whether the module is compilation exportable.
Return whether the module is runnable (supports get_function).
same_as
(other)Check object identity.
write_to_file
(file_name[, fmt])Write the current module to file.
Attributes
Get imported modules.
Get type key of the module.
- entry_name = 'main'#
- implements_function(name, query_imports=False)[source]#
Return True if the module defines a global function.
Note
that has_function(name) does not imply get_function(name) is non-null since the module that has_function(name) does not imply get_function(name) is non-null since the module may be, eg, a CSourceModule which cannot supply a packed-func implementation of the function without further compilation. However, get_function(name) non null should always imply has_function(name).
- get_function(name, query_imports=False)[source]#
Get function from the module.
- Parameters:
- Returns:
f – The result function.
- Return type:
- import_module(module)[source]#
Add module to the import list of current one.
- Parameters:
module (tvm.runtime.Module) – The other module.
- Return type:
None
- get_property_mask()[source]#
Get the runtime module property mask. The mapping is stated in ModulePropertyMask.
- Returns:
mask – Bitmask of runtime module property
- Return type:
- is_binary_serializable()[source]#
Return whether the module is binary serializable (supports save_to_bytes).
- Returns:
b – True if the module is binary serializable.
- Return type:
Bool
- is_runnable()[source]#
Return whether the module is runnable (supports get_function).
- Returns:
b – True if the module is runnable.
- Return type:
Bool
- is_compilation_exportable()[source]#
Return whether the module is compilation exportable.
write_to_file is supported for object or source.
- Returns:
b – True if the module is compilation exportable.
- Return type:
Bool
- write_to_file(file_name, fmt='')[source]#
Write the current module to file.
- Parameters:
- Return type:
None
See also
runtime.Module.export_library
export the module to shared library.
- property imports_#