MCPcopy Create free account
hub / github.com/apache/tvm-ffi / __getattr__

Method __getattr__

python/tvm_ffi/module.py:163–170  ·  view source on GitHub ↗

Accessor to allow getting functions as attributes.

(self, name: str)

Source from the content-addressed store, hash-verified

161 return _ffi_api.ModuleImplementsFunction(self, name, query_imports)
162
163 def __getattr__(self, name: str) -> core.Function:
164 """Accessor to allow getting functions as attributes."""
165 try:
166 func = self.get_function(name)
167 except AttributeError as exc:
168 raise AttributeError(f"Module has no function '{name}'") from exc
169 setattr(self, name, func)
170 return func
171
172 def get_function(self, name: str, query_imports: bool = False) -> core.Function:
173 """Get function from the module.

Callers

nothing calls this directly

Calls 1

get_functionMethod · 0.95

Tested by

no test coverage detected