mlx.nn.Module.update_modules#
- Module.update_modules(modules: dict, strict: bool = True) Module #
Replace the child modules of this
Module
instance with the provided ones in the dict of dicts and lists.It is the equivalent of
Module.update()
but for modules instead of parameters and allows us to flexibly edit complex architectures by programmatically swapping layers.The passed in parameters dictionary need not be a full dictionary similar to
modules()
. Only the provided locations will be updated.