@Namespace(value="tvm::runtime") @NoOffset @Properties(inherit=tvm_runtime.class) public class ModuleNode extends TVMObject
class MyModuleNode : public ModuleNode {
public:
// implement the interface
};
// use make_object to create a specific
// instace of MyModuleNode.
Module CreateMyModule() {
ObjectPtr<MyModuleNode> n =
tvm::runtime::make_object<MyModuleNode>();
return Module(n);
}
TVMObject.FDeleterPointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter| Modifier and Type | Field and Description |
|---|---|
static int |
_type_child_slots |
static boolean |
_type_final |
static int |
_type_index |
_type_child_slots_can_overflow, _type_has_method_sequal_reduce, _type_has_method_shash_reduce, _type_has_method_visit_attrs| Constructor and Description |
|---|
ModuleNode(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
_GetOrAllocRuntimeTypeIndex() |
static int |
_type_child_slots() |
static boolean |
_type_final() |
static int |
_type_index() |
static BytePointer |
_type_key() |
BytePointer |
GetFormat()
\brief Get the format of the module, when available.
|
PackedFunc |
GetFuncFromEnv(BytePointer name)
\brief Get a function from current environment
The environment includes all the imports as well as Global functions.
|
PackedFunc |
GetFuncFromEnv(String name) |
PackedFunc |
GetFunction(BytePointer name) |
PackedFunc |
GetFunction(BytePointer name,
boolean query_imports)
\brief Get packed function from current module by name.
|
PackedFunc |
GetFunction(BytePointer name,
ObjectPtr sptr_to_self)
\brief Get a PackedFunc from module.
|
PackedFunc |
GetFunction(String name) |
PackedFunc |
GetFunction(String name,
boolean query_imports) |
PackedFunc |
GetFunction(String name,
ObjectPtr sptr_to_self) |
BytePointer |
GetSource() |
BytePointer |
GetSource(BytePointer format)
\brief Get the source code of module, when available.
|
String |
GetSource(String format) |
boolean |
ImplementsFunction(TVMString name) |
boolean |
ImplementsFunction(TVMString name,
boolean query_imports)
\brief Returns true if this module has a definition for a function of \p name.
|
void |
Import(Module other)
\brief Import another module into this module.
|
Module |
imports() |
boolean |
IsDSOExportable()
\brief Returns true if this module is 'DSO exportable'.
|
static int |
RuntimeTypeIndex() |
void |
SaveToBinary(Stream stream)
\brief Save the module to binary stream.
|
void |
SaveToFile(BytePointer file_name,
BytePointer format)
\brief Save the module to file.
|
void |
SaveToFile(String file_name,
String format) |
BytePointer |
type_key() |
_type_child_slots_can_overflow, _type_has_method_sequal_reduce, _type_has_method_shash_reduce, _type_has_method_visit_attrs, getPointer, GetTypeKey, GetTypeKeyHash, position, put, type_index, TypeIndex2Key, TypeIndex2KeyHash, TypeKey2Index, TypeKey2Index, uniqueaddress, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zeropublic static final int _type_index
public static final boolean _type_final
public static final int _type_child_slots
public ModuleNode(Pointer p)
Pointer(Pointer).@Cast(value="const char*") public BytePointer type_key()
@ByVal public PackedFunc GetFunction(@StdString BytePointer name, @Const @ByRef ObjectPtr sptr_to_self)
name - the name of the function.sptr_to_self - The ObjectPtr that points to this module node.@ByVal public PackedFunc GetFunction(@StdString String name, @Const @ByRef ObjectPtr sptr_to_self)
public void SaveToFile(@StdString BytePointer file_name, @StdString BytePointer format)
file_name - The file to be saved to.format - The format of the file.public void SaveToFile(@StdString String file_name, @StdString String format)
public void SaveToBinary(Stream stream)
stream - The binary stream to save to.
\note It is recommended to implement this for device modules,
but not necessarily host modules.
We can use this to do AOT loading of bundled device functions.@StdString public BytePointer GetSource(@StdString BytePointer format)
format - Format of the source code, can be empty by default.@StdString public BytePointer GetSource()
@StdString public String GetSource(@StdString String format)
@StdString public BytePointer GetFormat()
@ByVal public PackedFunc GetFunction(@StdString BytePointer name, @Cast(value="bool") boolean query_imports)
name - The name of the function.query_imports - Whether also query dependency modules.@ByVal public PackedFunc GetFunction(@StdString BytePointer name)
@ByVal public PackedFunc GetFunction(@StdString String name, @Cast(value="bool") boolean query_imports)
@ByVal public PackedFunc GetFunction(@StdString String name)
public void Import(@ByVal Module other)
other - The module to be imported.
\note Cyclic dependency is not allowed among modules,
An error will be thrown when cyclic dependency is detected.@Const public PackedFunc GetFuncFromEnv(@StdString BytePointer name)
name - name of the function.@Const public PackedFunc GetFuncFromEnv(@StdString String name)
@StdVector public Module imports()
@Cast(value="bool") public boolean IsDSOExportable()
@Cast(value="bool") public boolean ImplementsFunction(@Const @ByRef TVMString name, @Cast(value="bool") boolean query_imports)
@Cast(value="bool") public boolean ImplementsFunction(@Const @ByRef TVMString name)
@MemberGetter @Cast(value="const uint32_t") public static int _type_index()
@MemberGetter @Cast(value="const char*") public static BytePointer _type_key()
@MemberGetter @Cast(value="const bool") public static boolean _type_final()
@MemberGetter public static int _type_child_slots()
Copyright © 2022. All rights reserved.