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
Noisy Linear Layer 是一个在权重上添加了参数化噪声的线性层。这种诱导的随机性可用于强化学习网络中,以帮助智能体的策略进行有效的探索。噪声的参数与任何其他剩余的网络权重一起通过梯度下降进行学习。通常采用因子化高斯噪声。
- 参数:
in_features (int) – 输入特征维度
out_features (int) – 输出特征维度
bias (bool, optional) – 如果为
True
,则会在矩阵乘法 Ax + b 中添加一个偏置项。默认为True
device (DEVICE_TYPING, optional) – 层的设备。默认为
"cpu"
dtype (torch.dtype, optional) – 参数的数据类型。默认为
None
(默认的 PyTorch 数据类型)std_init (scalar, optional) – 优化前高斯标准差的初始值。默认为
0.1