ReLU¶
- class torch.nn.ReLU(inplace=False)[source][source]¶
逐元素地应用修正线性单元函数。
- 参数
inplace (bool) – 可选地进行就地(in-place)操作。默认值:
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)))