泄漏ReLU
- classtorch.nn.LeakyReLU(negative_slope=0.01, inplace=False)[源代码]
-
对每个元素应用LeakyReLU函数。
$\text{LeakyReLU}(x) = \max(0, x) + \text{negative\_slope} * \min(0, x)$或者
$\text{LeakyReLU}(x) = \begin{cases} x, & \text{ if } x \geq 0 \\ \text{negative\_slope} \times x, & \text{ otherwise } \end{cases}$- 形状:
-
-
输入: $(*)$,其中 * 表示任意数量的额外维度。
-
输出: $(*)$,形状与输入相同
-
示例:
>>> m = nn.LeakyReLU(0.1) >>> input = torch.randn(2) >>> output = m(input)