_init_api()
#
import set_env
import tvm
tvm._ffi.registry._init_api??
Signature: tvm._ffi.registry._init_api(namespace, target_module_name=None)
Source:
def _init_api(namespace, target_module_name=None):
"""Initialize api for a given module name
namespace : str
The namespace of the source registry
target_module_name : str
The target module name if different from namespace
"""
target_module_name = target_module_name if target_module_name else namespace
if namespace.startswith("tvm."):
_init_api_prefix(target_module_name, namespace[4:])
else:
_init_api_prefix(target_module_name, namespace)
File: /media/pc/data/lxw/ai/tvm/python/tvm/_ffi/registry.py
Type: function
tvm._ffi.registry._init_api_prefix??
Signature: tvm._ffi.registry._init_api_prefix(module_name, prefix)
Docstring: <no docstring>
Source:
def _init_api_prefix(module_name, prefix):
module = sys.modules[module_name]
for name in list_global_func_names():
if not name.startswith(prefix):
continue
fname = name[len(prefix) + 1 :]
target_module = module
if fname.find(".") != -1:
continue
f = get_global_func(name)
ff = _get_api(f)
ff.__name__ = fname
ff.__doc__ = "TVM PackedFunc %s. " % fname
setattr(target_module, ff.__name__, ff)
File: /media/pc/data/lxw/ai/tvm/python/tvm/_ffi/registry.py
Type: function
tvm._ffi.registry._get_api??
Signature: tvm._ffi.registry._get_api(f)
Docstring: <no docstring>
Source:
def _get_api(f):
flocal = f
flocal.is_global = True
return flocal
File: /media/pc/data/lxw/ai/tvm/python/tvm/_ffi/registry.py
Type: function