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.nn.Sigmoid.txt 1.0 kB

123456789101112131415161718192021222324252627282930313233343536
  1. Class mindspore.nn.Sigmoid
  2. Sgmoid激活函数。
  3. 按元素计算Sgmoid激活函数。
  4. Sigmoid函数定义为:
  5. .. math::
  6. \text{sigmoid}(x_i) = \frac{1}{1 + \exp(-x_i)},
  7. 其中:math:`x_i`是输入的元素。
  8. 关于Sigmoid的图例见`Sigmoid <https://en.wikipedia.org/wiki/Sigmoid_function#/media/File:Logistic-curve.svg>`_。
  9. 输入:
  10. - **x** (Tensor) - 数据类型为float16或float32的Sgmoid输入。
  11. shape为:math:`(N,*)`,其中:math:`*`表示任意的附加维度。
  12. 输出:
  13. Tensor,数据类型和shape与 `x` 的相同。
  14. 异常:
  15. TypeError:`x`的数据类型既不是float16也不是float32。
  16. 支持平台:
  17. ``Ascend`` ``GPU`` ``CPU``
  18. 示例:
  19. >>> x = Tensor(np.array([-1, -2, 0, 2, 1]), mindspore.float16)
  20. >>> sigmoid = nn.Sigmoid()
  21. >>> output = sigmoid(x)
  22. >>> print(output)
  23. [0.2688 0.11914 0.5 0.881 0.7305 ]