ReLU¶
- class torch.nn.ReLU(inplace=False)[來源][來源]¶
以元素方式應用修正線性單元函數。
- 參數
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)))