ReLU#
- class torch.nn.modules.activation.ReLU(inplace=False)[原始碼]#
逐元素應用線性整流單元函式。
- 引數
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)))