Python API#

TVM FFI Python package.

Object#

Object

Base class of all TVM FFI objects.

Tensor#

Tensor

Managed n-dimensional array compatible with DLPack.

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

Import a foreign array that implements the DLPack producer protocol.

Shape(content)

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

dtype(content)

TVM FFI dtype class.

Device

A device descriptor used by TVM FFI and DLPack.

DLDeviceType(value[, names, module, ...])

Enumeration mirroring DLPack's DLDeviceType.

device(device_type[, index])

Construct a TVM FFI device with given device type and index.

Function#

Function

Callable wrapper around a TVM FFI function.

Module#

Module(*args, **kwargs)

Module container for dynamically loaded Module.

system_lib([symbol_prefix])

Get system-wide library module singleton.

load_module(path)

Load module from file.

Containers#

Array(input_list)

Array container that represents a sequence of values in ffi.

Map(input_dict)

Map container.

Global Registry#

register_error([name_or_cls, cls])

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

register_object([type_key])

Register object type.

register_global_func(func_name[, f, override])

Register global function.

get_global_func(name[, allow_missing])

Get a global function by name.

get_global_func_metadata(name)

Get the type schema string of a global function by name.

init_ffi_api(namespace[, target_module_name])

Initialize register ffi api functions into a given module.

remove_global_func(name)

Remove a global function by name.

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.

Inline Loading#

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.

Misc#

serialization

Serialization related utilities to enable some object can be pickled.

access_path

Access path classes.

convert(value)

Convert a python object to ffi values.

ObjectConvertible()

Base class for Python classes convertible to Object.