IndependentCellTrainer¶
- class IndependentCellTrainer(**kwargs)[source]¶
Bases:
CellTrainer,ABCTrainer for update methods without inter-cell dependencies.
Important
The
Layerobject “owns” theCellobjects but not theMonitorobjects.If applying a function to
Moduleobjects, e.g. via callingto()on theCellTrainer,~inferno.neural.Cellobjects will not be altered but~inferno.observe.Monitorand auxiliary state objects will be.Likewise, calling
to()on theLayerwill alter~inferno.neural.Cellobjects but not~inferno.observe.Monitorand auxiliary state objects.- class Unit(cell: Cell, state: Module, monitors: dict[str, Monitor])[source]¶
Bases:
ModuleTrainable units.
- state¶
auxiliary state.
- Type:
nn.Module
- monitors¶
associated monitors.
- Type:
nn.ModuleDict
- get_unit(name: str) Unit[source]¶
Gets a trainable unit.
This can be used if a single trainer should handle training on different devices. The returned module dictionary can then be altered in-place with
to()in order to move a cell (cell), its auxiliary state (state), and monitors (monitors) used by the trainer to a different device, or change the used data type.Calling
to()on the trainer itself will apply to all monitors and auxiliary states, but not to any cells.- Parameters:
name (str) – name of the cell to get alongside its auxiliary state.
- Returns:
specified cell, auxiliary state, and monitors.
- Return type:
- abstract register_cell(name: str, cell: Cell, **kwargs) Unit[source]¶
Adds a cell with any required state.
- Parameters:
- Returns:
specified cell, auxiliary state, and monitors, as returned by
get_unit().- Return type:
- Raises:
NotImplementedError –
register_cellmust be implemented by the subclass.