Softplus ¬
- class torch.nn.Softplus(β=1.0, threshold=20.0)[来源][来源] ¬
元素级应用 Softplus 函数。
SoftPlus 是 ReLU 函数的平滑近似,可以用来约束机器的输出始终为正。
为了数值稳定性,实现会回退到线性函数当 。
- 参数:
beta (浮点数) - Softplus 公式的 值。默认:1
threshold (浮点数) - 超过此值的值将回退到线性函数。默认:20
- 形状:
输入: ,其中 表示任意数量的维度。
输出: ,与输入具有相同的形状。
示例:
>>> m = nn.Softplus() >>> input = torch.randn(2) >>> output = m(input)