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)))