Class: TVMRuntime

tvm.TVMRuntime()

new TVMRuntime()

TVMRuntime object for interacting with TVM runtime. This object can be constructed using tvm_runtime.create
Source:

Members

float32

Float32 type
Source:

int32

Int32 type
Source:

Methods

constant(value, dtype, The)

Create a typed scalar constant. This can be used to pass number as integer types to tvm function.
Parameters:
Name Type Description
value number The value of the data.
dtype string The data type.
The tvm.TVMConstant created typed scalar.
Source:

context(device_type,, device_id,) → {tvm.TVMContext}

Construct a TVMContext given device type and id.
Parameters:
Name Type Description
device_type, number string or int, The device type.
device_id, number the device id.
Source:
Returns:
The created TVMContext
Type
tvm.TVMContext

convertFunc(f) → {function}

Convert a javascript function to TVM function.
Parameters:
Name Type Description
f function javascript function.
Source:
Returns:
The created TVMFunction.
Type
function

createGraphRuntime(graph_json_str, libmod, ctx) → {GraphModule}

Create a runtime executor module given a graph and a module.
Parameters:
Name Type Description
graph_json_str string The Json string of the graph.
libmod TVMModule The TVM module.
ctx TVMContext The context to deploy the module.
Source:
Returns:
Runtime graph module for executing the graph.
Type
GraphModule

empty(shape, dtype, ctx) → {tvm.NDArray}

Create empty ndarray with given shape.
Parameters:
Name Type Description
shape Array.<number> The shape of the array.
dtype string The data type of the array, optional, default="float32"
ctx tvm.TVMContext The context of the array, optional, default=cpu(0).
Source:
Returns:
The created ndarray.
Type
tvm.NDArray

getGlobalFunc(The) → {function}

Get a global function from TVM runtime.
Parameters:
Name Type Description
The string name of the function.
Source:
Returns:
The corresponding function, null if function do not exist
Type
function

isPackedFunc(f) → {boolean}

Check if a function is TVM PackedFunc
Parameters:
Name Type Description
f function function to be checked.
Source:
Returns:
Whether f is PackedFunc
Type
boolean

listGlobalFuncNames() → {Array.<string>}

List all global function names in the TVM runtime.
Source:
Returns:
List of global function names.
Type
Array.<string>

loadModuleFromFile(file_name, format) → {tvm.TVMModule}

Load a TVM module from a library file. The file must be present in the Emscripten virtual file system. For example, you can pass "--preload-file file" or "--preload-file dir/" to "emcc" when compiling the TVM library, in order to populate files into the file system. For more detail, see: https://kripken.github.io/emscripten-site/docs/porting/files/packaging_files
Parameters:
Name Type Description
file_name string Path of the file to be loaded. The path refers to the Emscripten virtual file system.
format string The format of the file.
Source:
Returns:
The loaded module.
Type
tvm.TVMModule

logger(message)

Logging function. Override this to change logger behavior.
Parameters:
Name Type Description
message string
Source:

registerFunc(name, f, override)

Register function to be global function in tvm runtime.
Parameters:
Name Type Description
name string The name of the function.
f function function to be registered.
override boolean Whether overwrite function in existing registry.
Source:

systemLib() → {tvm.TVMModule}

Get system-wide library module singleton.5A System lib is a global module that contains self register functions in startup.
Source:
Returns:
The system module singleton.
Type
tvm.TVMModule