快捷方式

ReLU

class torch.nn.ReLU(inplace=False)[來源][來源]

以元素方式應用修正線性單元函數。

ReLU(x)=(x)+=max(0,x)\text{ReLU}(x) = (x)^+ = \max(0, x)

參數

inplace (bool) – 是否選擇性地進行原地 (in-place) 操作。預設值:False

形狀
  • 輸入:()(*),其中 * 表示任意數量的維度。

  • 輸出:()(*),與輸入相同的形狀。

../_images/ReLU.png

範例

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

文件

取得 PyTorch 的完整開發者文件

檢視文件

教學

取得針對初學者和進階開發者的深入教學

檢視教學

資源

尋找開發資源並獲得問題解答

檢視資源