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)[源代码]¶
噪声线性层。
出自《用于探索的噪声网络》(Noisy Networks for Exploration),https://arxiv.org/abs/1706.10295v3
噪声线性层是一种在线性层权重中添加参数化噪声的层。这种引入的随机性可用于 RL(强化学习)网络的智能体策略中,以帮助进行高效探索。噪声的参数与其他剩余网络权重一起通过梯度下降进行学习。通常采用分解式高斯噪声。
- 参数:
in_features (int) – 输入特征维度
out_features (int) – 输出特征维度
bias (bool, 可选) – 如果为
True
,则会在矩阵乘法中添加一个偏置项:Ax + b。默认为True
device (DEVICE_TYPING, 可选) – 层的设备。默认为
"cpu"
dtype (torch.dtype, 可选) – 参数的数据类型。默认为
None
(默认 PyTorch 数据类型)std_init (标量, 可选) – 优化前高斯标准差的初始值。默认为
0.1