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

Method get_function

python/dgl/_ffi/function.py:96–123  ·  view source on GitHub ↗

Get function from the module. Parameters ---------- name : str The name of the function query_imports : bool Whether also query modules imported by this module. Returns ------- f : Function The result func

(self, name, query_imports=False)

Source from the content-addressed store, hash-verified

94 return self._entry
95
96 def get_function(self, name, query_imports=False):
97 """Get function from the module.
98
99 Parameters
100 ----------
101 name : str
102 The name of the function
103
104 query_imports : bool
105 Whether also query modules imported by this module.
106
107 Returns
108 -------
109 f : Function
110 The result function.
111 """
112 ret_handle = FunctionHandle()
113 check_call(
114 _LIB.DGLModGetFunction(
115 self.handle,
116 c_str(name),
117 ctypes.c_int(query_imports),
118 ctypes.byref(ret_handle),
119 )
120 )
121 if not ret_handle.value:
122 raise AttributeError("Module has no function '%s'" % name)
123 return Function(ret_handle, False)
124
125 def import_module(self, module):
126 """Add module to the import list of current one.

Callers 2

entry_funcMethod · 0.95
__getitem__Method · 0.95

Calls 3

check_callFunction · 0.85
c_strFunction · 0.85
FunctionClass · 0.85

Tested by

no test coverage detected