Managed reference class to IRModuleNode.
More...
#include <module.h>
|
| IRModule (Map< GlobalVar, BaseFunc > functions, Map< GlobalTypeVar, TypeData > type_definitions={}, std::unordered_set< String > import_set={}, SourceMap map={}, DictAttrs attrs={}) |
| constructor More...
|
|
| IRModule () |
| default constructor More...
|
|
| IRModule (ObjectPtr< Object > n) |
| constructor More...
|
|
IRModuleNode * | operator-> () const |
|
IRModule | ShallowCopyIRModule (IRModule mod) |
| Create a shallow copy of an IRModule. More...
|
|
| TVM_DEFINE_OBJECT_REF_COW_METHOD (IRModuleNode) |
|
| ObjectRef ()=default |
| default constructor More...
|
|
| ObjectRef (ObjectPtr< Object > data) |
| Constructor from existing object ptr. More...
|
|
bool | same_as (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator== (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator!= (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator< (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | defined () const |
|
const Object * | get () const |
|
const Object * | operator-> () const |
|
bool | unique () const |
|
int | use_count () const |
|
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>> |
const ObjectType * | as () const |
| Try to downcast the internal Object to a raw pointer of a corresponding type. More...
|
|
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>> |
Optional< ObjectRefType > | as () const |
| Try to downcast the ObjectRef to a Optional<T> of the requested type. More...
|
|
|
static std::pair< IRModule, GlobalVar > | FromExprInContext (const RelayExpr &expr, const Map< GlobalVar, BaseFunc > &global_funcs={}, const Map< GlobalTypeVar, TypeData > &type_definitions={}, std::unordered_set< String > import_set={}) |
| Constructs a module from a standalone expression expr . More...
|
|
static IRModule | FromExpr (const RelayExpr &expr, const Map< GlobalVar, BaseFunc > &global_funcs={}, const Map< GlobalTypeVar, TypeData > &type_definitions={}) |
| As for FromExprInContext , but assuming expr is bound to 'main' and no imports. More...
|
|
static IRModule | FromText (const String &text, const String &source_path) |
| Parse text format source file into an IRModule. More...
|
|
Managed reference class to IRModuleNode.
- See also
- IRModuleNode
◆ ContainerType
Declare the container type.
◆ IRModule() [1/3]
constructor
- Parameters
-
functions | Functions in the module. |
type_definitions | Type definitions in the module. |
import_set | Set of imported files in the module. |
map | The module source map. |
attrs | The module attributes. |
◆ IRModule() [2/3]
tvm::IRModule::IRModule |
( |
| ) |
|
|
inline |
◆ IRModule() [3/3]
◆ FromExpr()
As for FromExprInContext
, but assuming expr
is bound to 'main' and no imports.
◆ FromExprInContext()
Constructs a module from a standalone expression expr
.
If expr
is a function it will be bound directly. Otherwise a function over the free variables of expr
(possibly none) with expr
as body is created and bound.
The function is bound to, in preference order:
- The "global_symbol" attribute of
expr
, if it is a function with that attribute.
- 'main'
- A unique name derived from 'main' if 'main' is already bound in
global_funcs
.
Additional global functions and type definitions may be included in the result module.
See also FromExpr
.
- Parameters
-
expr | The expression to set as the main function to the module. |
global_funcs | The global function map. Default empty. |
type_definitions | The global type definition map. Default empty. |
import_set | Set of external modules already imported. Default empty. |
- Returns
- A module with
expr
set as the main function, and the global var to which expr
was bound (typcially 'main').
TODO(mbs): Does import_set and the bound global var need to be exposed via ffi?
◆ FromText()
Parse text format source file into an IRModule.
- Parameters
-
text | A string of Relay source code. |
source_path | The path to the source file. |
- Returns
- A Relay module.
◆ operator->()
- Returns
- mutable pointers to the node.
◆ ShallowCopyIRModule()
Create a shallow copy of an IRModule.
- Parameters
-
- Returns
- The copied module.
◆ TVM_DEFINE_OBJECT_REF_COW_METHOD()
tvm::IRModule::TVM_DEFINE_OBJECT_REF_COW_METHOD |
( |
IRModuleNode |
| ) |
|
◆ _type_is_nullable
constexpr bool tvm::IRModule::_type_is_nullable = false |
|
staticconstexpr |
Declare whether Ref is nullable.
The documentation for this class was generated from the following file: