NoisyLinear¶
- class torchrl.modules.NoisyLinear(in_features: int, out_features: int, bias: bool = True, device: DEVICE_TYPING | None = None, dtype: torch.dtype | None = None, std_init: float = 0.1)[源代码]¶
带噪声的线性层。
发表于《Noisy Networks for Exploration》,https://arxiv.org/abs/1706.10295v3
带噪声的线性层是一种在权重上添加参数化噪声的线性层。这种诱导的随机性可以在 RL 网络中用于代理策略,以促进有效的探索。噪声的参数与任何其他剩余网络权重一起通过梯度下降进行学习。因子化高斯噪声是通常使用的噪声类型。
- 参数:
in_features (int) – 输入特征维度
out_features (int) – 输出特征维度
bias (bool, optional) – 如果为
True
,则会在矩阵乘法 Ax + b 中添加偏置项。默认为True
device (DEVICE_TYPING, optional) – 层的设备。默认为
"cpu"
dtype (torch.dtype, optional) – 参数的 dtype。默认为
None
(默认 PyTorch dtype)std_init (scalar, optional) – 优化前高斯标准偏差的初始值。默认为
0.1