MCPcopy
hub / github.com/dmlc/dgl / get_global_func

Function get_global_func

python/dgl/_ffi/function.py:209–233  ·  view source on GitHub ↗

Get a global function by name Parameters ---------- name : str The name of the global function allow_missing : bool Whether allow missing function or raise an error. Returns ------- func : dgl.Function The function to be returned, None if functi

(name, allow_missing=False)

Source from the content-addressed store, hash-verified

207
208
209def get_global_func(name, allow_missing=False):
210 """Get a global function by name
211
212 Parameters
213 ----------
214 name : str
215 The name of the global function
216
217 allow_missing : bool
218 Whether allow missing function or raise an error.
219
220 Returns
221 -------
222 func : dgl.Function
223 The function to be returned, None if function is missing.
224 """
225 handle = FunctionHandle()
226 check_call(_LIB.DGLFuncGetGlobal(c_str(name), ctypes.byref(handle)))
227 if handle.value:
228 return Function(handle, False)
229 else:
230 if allow_missing:
231 return None
232 else:
233 raise ValueError("Cannot find global function %s" % name)
234
235
236def list_global_func_names():

Callers 2

_init_api_prefixFunction · 0.85
_init_internal_apiFunction · 0.85

Calls 3

check_callFunction · 0.85
c_strFunction · 0.85
FunctionClass · 0.85

Tested by

no test coverage detected