ReLU
- 类torch.nn.ReLU(inplace=False)[源代码]
-
对元素应用修正线性单元(ReLU)函数。
$\text{ReLU}(x) = \max(0, x)$
- 参数
-
inplace (bool) – 是否以就地方式执行操作(可选)。默认值:
False
- 形状:
-
-
输入: $(*)$,其中$*$表示任意维度的数量。
-
输出: $(*)$,形状与输入相同。
-
示例:
>>> m = nn.ReLU() >>> input = torch.randn(2) >>> output = m(input) An implementation of CReLU - https://arxiv.org/abs/1603.05201 >>> m = nn.ReLU() >>> input = torch.randn(2).unsqueeze(0) >>> output = torch.cat((m(input), m(-input)))