MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_subattr

Function get_subattr

imperative/python/megengine/traced_module/utils.py:328–339  ·  view source on GitHub ↗
(module: Module, target: str)

Source from the content-addressed store, hash-verified

326
327
328def get_subattr(module: Module, target: str):
329 # todo : remove this import
330 from .node import ModuleNode
331
332 if target == "":
333 return module
334 *prefix, name = target.split(".")
335 for item in prefix:
336 module = getattr(module, item)
337 if not isinstance(module, (Module, ModuleNode)):
338 raise AttributeError("`{}` is not an Module".format(item))
339 return getattr(module, name)

Callers 5

_check_qat_moduleFunction · 0.90
_check_paramFunction · 0.90
_check_qualnameFunction · 0.90
fold_conv_mulMethod · 0.85
fold_convm_bnMethod · 0.85

Calls 1

formatMethod · 0.45

Tested by 3

_check_qat_moduleFunction · 0.72
_check_paramFunction · 0.72
_check_qualnameFunction · 0.72