tvm._ffi 查找/移除全局函数

tvm._ffi 查找/移除全局函数#

import tvm._ffi
tvm._ffi.registry.list_global_func_names?
Signature: tvm._ffi.registry.list_global_func_names()
Docstring:
Get list of global functions registered.

Returns
-------
names : list
   List of global functions names.
File:      /media/pc/data/lxw/ai/tvm/python/tvm/_ffi/registry.py
Type:      function
tvm._ffi.registry.remove_global_func?
Signature: tvm._ffi.registry.remove_global_func(name)
Docstring:
Remove a global function by name

Parameters
----------
name : str
    The name of the global function
File:      /media/pc/data/lxw/ai/tvm/python/tvm/_ffi/registry.py
Type:      function
@tvm._ffi.register_func("tvm.ext.chaos")
def demo():
    print("RT")

print("tvm.ext.chaos" in tvm._ffi.registry.list_global_func_names())
tvm._ffi.registry.remove_global_func("tvm.ext.chaos") # 移除全局函数
"tvm.ext.chaos" in tvm._ffi.registry.list_global_func_names()
True
False