tvm_ffi.get_global_func

tvm_ffi.get_global_func#

tvm_ffi.get_global_func(name, allow_missing=False)[source]#

Get a global function by name.

Parameters:
  • name (str) – The name of the global function

  • allow_missing (bool, default: False) – Whether allow missing function or raise an error.

Return type:

Function | None

Returns:

func – The function to be returned, None if function is missing.

Examples

import tvm_ffi

@tvm_ffi.register_global_func("demo.echo")
def echo(x):
    return x

f = tvm_ffi.get_global_func("demo.echo")
assert f(123) == 123