快捷方式

ReLU

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

逐元素地應用修正線性單元函式。

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 的全面開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得解答

檢視資源