Python API#

TVM FFI Python package.

Object#

Object

Base class of all TVM FFI objects.

register_object([type_key])

Register object type.

Function and Module#

Function

Python class that wraps a function with tvm-ffi ABI.

Module

Module container for dynamically loaded Module.

register_global_func(func_name[, f, override])

Register global function.

get_global_func()

Get a global function by name.

system_lib([symbol_prefix])

Get system-wide library module singleton.

load_module(path)

Load module from file.

init_ffi_api(namespace[, target_module_name])

Initialize register ffi api functions into a given module.

register_error([name_or_cls, cls])

Register an error class so it can be recognized by the ffi error handler.

convert(value)

Convert a python object to ffi values.

Tensor#

Shape(content)

Shape tuple that represents ffi::Shape returned by an FFI call.

Tensor

Tensor object that represents a managed n-dimensional array.

Device

Device represents a device in the ffi system.

from_dlpack(ext_tensor, *[, ...])

Convert an external tensor to an Tensor.

Containers#

Array(input_list)

Array container that represents a sequence of values in ffi.

Map(input_dict)

Map container.

Stream Context#

StreamContext(device, stream)

Represent a stream context in the FFI system.

use_torch_stream([context])

Create an FFI stream context with a Torch stream or graph.

use_raw_stream(device, stream)

Create a ffi stream context with given device and stream handle.

Utility#

C++ integration helpers for building and loading inline modules.

cpp.load_inline(name, *[, cpp_sources, ...])

Compile, build and load a C++/CUDA module from inline source code.

cpp.build_inline(name, *[, cpp_sources, ...])

Compile and build a C++/CUDA module from inline source code.