DuelingCnnDQNet¶
- class torchrl.modules.DuelingCnnDQNet(out_features: int, out_features_value: int = 1, cnn_kwargs: Optional[dict] = None, mlp_kwargs: Optional[dict] = None, device: Optional[Union[device, str, int]] = None)[source]¶
Dueling CNN Q-network.
Presented in https://arxiv.org/abs/1511.06581
- Parameters:
out_features (int) – number of features for the advantage network
out_features_value (int) – number of features for the value network
cnn_kwargs (dict, optional) –
kwargs for the feature network. Default is
>>> cnn_kwargs = { ... 'num_cells': [32, 64, 64], ... 'strides': [4, 2, 1], ... 'kernels': [8, 4, 3], ... }
mlp_kwargs (dict, optional) –
kwargs for the advantage and value network. Default is
>>> mlp_kwargs = { ... "depth": 1, ... "activation_class": nn.ELU, ... "num_cells": 512, ... "bias_last_layer": True, ... }
device (Optional[DEVICE_TYPING]) – device to create the module on.
- forward(x: Tensor) Tensor [source]¶
Defines 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
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.