You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.Elu.rst 1.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. mindspore.ops.Elu
  2. =================
  3. .. py:class:: mindspore.ops.Elu(*args, **kwargs)
  4. 指数线性单元激活函数(Exponential Linear Uint activation function)。
  5. 对输入的每个元素计算Elu。该激活函数定义如下:
  6. .. math::
  7. \text{ELU}(x)= \left\{
  8. \begin{array}{align}
  9. \alpha(e^{x} - 1) & \text{if } x \le 0\\
  10. x & \text{if } x \gt 0\\
  11. \end{array}\right.
  12. ELU相关图参见 `ELU <https://en.wikipedia.org/wiki/Activation_function#/media/File:Activation_elu.svg>`_ 。
  13. **参数:**
  14. **alpha** (float):Elu的alpha值,数据类型为浮点数。默认值:1.0。
  15. **输入:**
  16. **x** (Tensor) - 用于计算Elu的Tensor,数据类型为float16或float32。shape为 :math:`(N,*)` ,:math:`*` 表示任意的附加维度数。
  17. **输出:**
  18. Tensor,shape和数据类型与 `x` 相同。
  19. **异常:**
  20. - **TypeError** - `alpha` 不是float。
  21. - **TypeError** - `x` 的数据类型既不是float16也不是float32。
  22. - **ValueError** - `alpha` 不等于1.0。
  23. **支持平台:**
  24. ``Ascend`` ``GPU`` ``CPU``
  25. **样例:**
  26. >>> x = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32)
  27. >>> elu = ops.Elu()
  28. >>> output = elu(x)
  29. >>> print(output)
  30. [[-0.63212055 4. -0.99966455]
  31. [ 2. -0.99326205 9. ]]