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

Method modules

imperative/python/megengine/module/module.py:349–355  ·  view source on GitHub ↗

r"""Returns an iterable for all the modules within this module, including itself.

(self, **kwargs)

Source from the content-addressed store, hash-verified

347 )
348
349 def modules(self, **kwargs) -> "Iterable[Module]":
350 r"""Returns an iterable for all the modules within this module, including itself."""
351 if "with_parent" in kwargs and kwargs["with_parent"]:
352 yield self, None
353 else:
354 yield self
355 yield from self._flatten(with_key=False, predicate=_is_module, **kwargs)
356
357 def named_modules(
358 self, prefix: Optional[str] = None, **kwargs

Callers 10

applyMethod · 0.95
recursive_backup_statsFunction · 0.80
recursive_recover_statsFunction · 0.80
__init__Method · 0.80
test_module_apiFunction · 0.80
test_flatten_with_parentFunction · 0.80
test_producer_and_usersFunction · 0.80
__init__Method · 0.80

Calls 1

_flattenMethod · 0.95

Tested by 6

__init__Method · 0.64
test_module_apiFunction · 0.64
test_flatten_with_parentFunction · 0.64
test_producer_and_usersFunction · 0.64