评价此页

ELU#

class torch.nn.modules.activation.ELU(alpha=1.0, inplace=False)[source]#

逐元素应用指数线性单元 (ELU) 函数。

论文中描述的方法:Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)

ELU 定义为

ELU(x)={x, if x>0α(exp(x)1), if x0\text{ELU}(x) = \begin{cases} x, & \text{ if } x > 0\\ \alpha * (\exp(x) - 1), & \text{ if } x \leq 0 \end{cases}
参数
  • alpha (float) – ELU 公式中的 α\alpha 值。 默认值:1.0

  • inplace (bool) – 可以选择是否就地执行操作。默认值:False

形状
  • 输入: ()(*),其中 * 表示任意数量的维度。

  • 输出: ()(*),形状与输入相同。

../_images/ELU.png

示例

>>> m = nn.ELU()
>>> input = torch.randn(2)
>>> output = m(input)
extra_repr()[source]#

返回模块的额外表示。

返回类型

str

forward(input)[source]#

执行前向传播。

返回类型

张量