tvm.relay.module

A global module storing everything needed to interpret or compile a Relay program.

class tvm.relay.module.Module(functions=None, type_definitions=None)

The global Relay module containing collection of functions.

Each global function is identified by an unique tvm.relay.GlobalVar. tvm.relay.GlobalVar and Module is necessary in order to enable recursions in function to avoid cyclic reference in the function.x

Parameters:functions (dict, optional.) – Map of global var to Function
get_global_type_var(name)

Get a global type variable in the function by name.

Parameters:name (str) – The name of the global type variable.
Returns:global_type_var – The global variable mapped to name.
Return type:GlobalTypeVar
Raises:tvm.TVMError if we cannot find corresponding global type var.
get_global_var(name)

Get a global variable in the function by name.

Parameters:name (str) – The name of the global variable.
Returns:global_var – The global variable mapped to name.
Return type:GlobalVar
Raises:tvm.TVMError if we cannot find corresponding global var.
update(other)

Insert functions in another Module to current one.

Parameters:other (Module) – The module to merge into the current Module.