baselooper.ModuleList#

class baselooper.ModuleList(modules: List[baselooper.module.Module], **kwargs)[source]#

Bases: baselooper.module.Module

A module which represents a list of other modules.

initialise(modules: Optional[Dict[str, baselooper.module.Module]] = None)[source]#

Perform initialization steps of all modules in the list.

Parameters

modules (Dict[str, Module]) – Dictionary of other modules which are already initialised

load_state_dict(state_dict: Dict[str, any], strict: bool = True)[source]#

Load the modules state from a dictionary.

Parameters
  • state_dict (Dict[str, any]) – The state dictionary to load

  • strict (bool) – If true rise an error on missing or additional keys in the state dict. If false these keys will be ignored.

log(state: baselooper.state.State)[source]#

Log information from all modules in the list.

Parameters

state (State) – The current state

state_dict() Dict[str, Any][source]#

Return the state of the module as dictionary.

All items of the dictionary should be serializable by pickle.

Returns

The modules current state as dictionary

Return type

Dict[str, Any]

step(state: baselooper.state.State)[source]#

Perform a step of all modules in the list on the state.

Parameters

state (State) – The current state

step_callback(state: baselooper.state.State) None[source]#

Call callback of all modules in the list.

Parameters

state (State) – The current state

teardown(state: baselooper.state.State)[source]#

Teardown all modules in the list.

Parameters

state (State) – The final state