NoisyLinear¶
- class torchrl.modules.NoisyLinear(in_features: int, out_features: int, bias: bool = True, device: Optional[Union[device, str, int]] = None, dtype: Optional[dtype] = None, std_init: float = 0.1)[source]¶
Noisy Linear Layer.
Presented in “Noisy Networks for Exploration”, https://arxiv.org/abs/1706.10295v3
A Noisy Linear Layer is a linear layer with parametric noise added to the weights. This induced stochasticity can be used in RL networks for the agent’s policy to aid efficient exploration. The parameters of the noise are learned with gradient descent along with any other remaining network weights. Factorized Gaussian noise is the type of noise usually employed.
- Parameters:
in_features (int) – input features dimension
out_features (int) – out features dimension
bias (bool, optional) – if
True
, a bias term will be added to the matrix multiplication: Ax + b. Defaults toTrue
device (DEVICE_TYPING, optional) – device of the layer. Defaults to
"cpu"
dtype (torch.dtype, optional) – dtype of the parameters. Defaults to
None
(default pytorch dtype)std_init (scalar, optional) – initial value of the Gaussian standard deviation before optimization. Defaults to
0.1