LayerList#
- class deeplay.list.LayerList(*args, **kwargs)#
Bases:
DeeplayModule,ModuleList,Generic[T]Methods Summary
append(module)Append a given module to the end of the list.
Configures the module with specified arguments.
extend(modules)Append modules from a Python iterable to the end of the list.
insert(index, module)Insert a given module before a given index in the list.
pop([key])remove(module)set_input_map(*args, **kwargs)set_output_map(*args, **kwargs)Methods Documentation
- append(module: DeeplayModule) LayerList[T]#
Append a given module to the end of the list.
- Args:
module (nn.Module): module to append
- configure(*args: int | slice | List[int], **kwargs: Any) None#
- configure(name: str, *args: Any, **kwargs: Any) None
Configures the module with specified arguments.
This method allows dynamic configuration of the module’s properties and behaviors. It can be used to set or modify the attributes and parameters of the module and, if applicable, its child modules. The method intelligently handles both direct attribute configuration and delegation to child modules’ configure methods.
Parameters#
- *argsAny
Positional arguments specifying the configuration settings. When the first argument is a string matching a configurable attribute, the method expects either one or two arguments: the attribute name and, optionally, its value. If the attribute is itself a DeeplayModule, subsequent arguments are passed to its configure method.
- **kwargsAny
Keyword arguments for configuration settings. If provided, these are used to update the module’s configuration directly.
Raises#
- ValueError
Raised if a configuration key is not recognized as a valid configurable for the module or if the provided arguments do not match the expected pattern for configuration.
Example Usage#
To configure a single attribute:
` module.configure('attribute_name', attribute_value) # or module.configure(attribute_name=attribute_value) `To configure multiple attributes using keyword arguments:
` module.configure(attribute1=value1, attribute2=value2) `To configure a child module’s attribute:
` module.configure('child_module_attribute', child_attribute=child_attribute_value) # or module.child_module.configure(child_attribute=child_attribute_value) `
- extend(modules: List[DeeplayModule]) LayerList[T]#
Append modules from a Python iterable to the end of the list.
- Args:
modules (iterable): iterable of modules to append
- insert(index: int, module: DeeplayModule) LayerList[T]#
Insert a given module before a given index in the list.
- Args:
index (int): index to insert. module (nn.Module): module to insert
- pop(key: int = -1) T#
- remove(module: DeeplayModule) LayerList[T]#
- set_input_map(*args: str, **kwargs: str)#
- set_output_map(*args: str, **kwargs: int)#