For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
ModuleDict
ModuleDict
class max.nn.ModuleDict
A Module subclass that stores child modules by string key.
The keys become child names in qualified paths. A pipeline stage that selects a subset of a complete model’s layers keeps each layer’s qualified path unchanged.
For example:
from max.nn import Linear, ModuleDict
layers = ModuleDict({"3": Linear(5, 10), "7": Linear(10, 5)})
assert dict(layers.parameters).keys() == {
"3.weight", "3.bias", "7.weight", "7.bias"
}