AdditiveGaussianModule¶
- class torchrl.modules.AdditiveGaussianModule(*args, **kwargs)[source]¶
Additive Gaussian PO module.
- Parameters:
spec (TensorSpec) – the spec used for sampling actions. The sampled action will be projected onto the valid action space once explored.
sigma_init (scalar, optional) – initial epsilon value. default: 1.0
sigma_end (scalar, optional) – final epsilon value. default: 0.1
annealing_num_steps (int, optional) – number of steps it will take for sigma to reach the
sigma_end
value. default: 1000mean (float, optional) – mean of each output element’s normal distribution. default: 0.0
std (float, optional) – standard deviation of each output element’s normal distribution. default: 1.0
- Keyword Arguments:
action_key (NestedKey, optional) – if the policy module has more than one output key, its output spec will be of type Composite. One needs to know where to find the action spec. default: “action”
Note
It is crucial to incorporate a call to
step()
in the training loop to update the exploration factor. Since it is not easy to capture this omission no warning or exception will be raised if this is ommitted!- forward(tensordict: TensorDictBase) TensorDictBase [source]¶
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
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.