ReLU#
- class torch.nn.ReLU(inplace=False)[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)))