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.SeLU.rst 1.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. mindspore.ops.SeLU
  2. ==================
  3. .. py:class:: mindspore.ops.SeLU(*args, **kwargs)
  4. 按元素计算输入Tensor的SeLU(scaled exponential Linear Unit)函数。
  5. 该激活函数定义为:
  6. .. math::
  7. E_{i} =
  8. scale *
  9. \begin{cases}
  10. x_{i}, &\text{if } x_{i} \geq 0; \cr
  11. \text{alpha} * (\exp(x_i) - 1), &\text{otherwise.}
  12. \end{cases}
  13. 其中, :math:`alpha` 和 :math:`scale` 是预定义的常量( :math:`alpha=1.67326324` , :math:`scale=1.05070098` )。
  14. 更多详细信息,请参见 `Self-Normalizing Neural Networks <https://arxiv.org/abs/1706.02515>`_ 。
  15. **输入:**
  16. - **input_x** (Tensor) - shape为 :math:`(N, *)` 的Tensor,其中, :math:`*` 表示任意的附加维度数,数据类型为float16或float32。
  17. **输出:**
  18. Tensor,数据类型和shape与 `input_x` 的相同。
  19. **支持平台:**
  20. ``Ascend``
  21. **异常:**
  22. - **TypeError** - `input_x` 的数据类型既不是float16也不是float32。
  23. **样例:**
  24. >>> input_x = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32)
  25. >>> selu = ops.SeLU()
  26. >>> output = selu(input_x)
  27. >>> print(output)
  28. [[-1.1113307 4.202804 -1.7575096]
  29. [ 2.101402 -1.7462534 9.456309 ]]