ReLU¶
- class torch.nn.ReLU(inplace=False)[source][source]¶
逐元素地应用修正线性单元函数。
- 参数
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)))