Evolvable CNN → LSTM encoder¶
Use with recurrent=True on algorithms such as PPO when observations are
3D image Box spaces (partial observability over pixels). The trainer and
EvolvableNetwork select this encoder automatically; manifests declare
arch: cnn_lstm under encoder_config.
Parameters¶
- class agilerl.modules.cnn_lstm.EvolvableCnnLstm(*args: Any, **kwargs: Any)¶
Convolutional feature extractor followed by an LSTM for image POMDPs.
Hidden-state keys follow
EvolvableLSTM:{name}_hand{name}_c. Architecture mutation is disabled until composite evolvable mutations exist.- Parameters:
- change_activation(activation: str, output: bool = False) None¶
Set the activation function for the network.
- create_network() ModuleDict¶
Build the CNN trunk, LSTM, and output projection.
- forward(x: ndarray[tuple[int, ...], dtype[_ScalarType_co]] | Tensor, hidden_state: dict[str, Tensor] | None = None) tuple[Tensor, dict[str, Tensor]]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.