Python class
ModuleList
ModuleList
class max.experimental.nn.ModuleList(iterable=(), /)
A Module subclass which is locally a list container.
ModuleList instances will use the stringified integer index of their
submodules as the name of the module for the purposes of
qualified paths.
For example:
from max.experimental.nn import Linear, Sequential
model = Sequential(
Linear(5, 10),
Linear(10, 5),
)
assert dict(model.parameters).keys() == {
"0.weight", "0.bias", "1.weight", "1.bias"
}children
Iterates over the direct child modules of the Module.
-
Yields:
-
(name, module)pairs, wherenameis the attribute name of the child on the module.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!