DdpgCnnActor¶
- class torchrl.modules.DdpgCnnActor(action_dim: int, conv_net_kwargs: Optional[dict] = None, mlp_net_kwargs: Optional[dict] = None, use_avg_pooling: bool = False, device: Optional[Union[device, str, int]] = None)[source]¶
DDPG Convolutional Actor class.
Presented in “CONTINUOUS CONTROL WITH DEEP REINFORCEMENT LEARNING”, https://arxiv.org/pdf/1509.02971.pdf
The DDPG Convolutional Actor takes as input an observation (some simple transformation of the observed pixels) and returns an action vector from it. It is trained to maximise the value returned by the DDPG Q Value network.
- Parameters:
action_dim (int) – length of the action vector.
conv_net_kwargs (dict, optional) – kwargs for the ConvNet. default: { ‘in_features’: None, “num_cells”: [32, 64, 64], “kernel_sizes”: [8, 4, 3], “strides”: [4, 2, 1], “paddings”: [0, 0, 1], ‘activation_class’: nn.ELU, ‘norm_class’: None, ‘aggregator_class’: SquashDims, ‘aggregator_kwargs’: {“ndims_in”: 3}, ‘squeeze_output’: True,
} –
mlp_net_kwargs – kwargs for MLP. Default: { ‘in_features’: None, ‘out_features’: action_dim, ‘depth’: 2, ‘num_cells’: 200, ‘activation_class’: nn.ELU, ‘bias_last_layer’: True,
} –
use_avg_pooling (bool, optional) – if
True
, a nn.AvgPooling layer is used to aggregate the output. Default isFalse
.device (Optional[DEVICE_TYPING]) – device to create the module on.
- forward(observation: Tensor) Tuple[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.