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

Method named_children

imperative/python/megengine/module/module.py:340–347  ·  view source on GitHub ↗

r"""Returns an iterable of key-submodule pairs for all the submodules that are direct attributes of this module, where 'key' is the attribute name of submodules.

(self, **kwargs)

Source from the content-addressed store, hash-verified

338 )
339
340 def named_children(self, **kwargs) -> "Iterable[Tuple[str, Module]]":
341 r"""Returns an iterable of key-submodule pairs for all the submodules that are
342 direct attributes of this module, where 'key' is the attribute name of
343 submodules.
344 """
345 yield from self._flatten(
346 with_key=True, predicate=_is_module, recursive=False, **kwargs
347 )
348
349 def modules(self, **kwargs) -> "Iterable[Module]":
350 r"""Returns an iterable for all the modules within this module, including itself."""

Callers 2

test_module_apiFunction · 0.80

Calls 1

_flattenMethod · 0.95

Tested by 2

test_module_apiFunction · 0.64