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

Method apply

imperative/python/megengine/module/module.py:375–383  ·  view source on GitHub ↗

r"""Applies function ``fn`` to all the modules within this module, including itself. Args: fn: the function to be applied on modules.

(self, fn: "Callable[[Module], Any]")

Source from the content-addressed store, hash-verified

373 )
374
375 def apply(self, fn: "Callable[[Module], Any]") -> None:
376 r"""Applies function ``fn`` to all the modules within this module, including
377 itself.
378
379 Args:
380 fn: the function to be applied on modules.
381 """
382 for it in self.modules():
383 fn(it)
384
385 @deprecated(version="1.0")
386 def zero_grad(self) -> None:

Callers 4

trainMethod · 0.95
disable_quantizeMethod · 0.95
_propagateFunction · 0.45
apply_exprFunction · 0.45

Calls 2

modulesMethod · 0.95
fnFunction · 0.50

Tested by

no test coverage detected