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.HSigmoid.txt 895 B

123456789101112131415161718192021222324252627282930313233
  1. Class mindspore.nn.HSigmoid
  2. Hard Sigmoid激活函数。
  3. 按元素计算Hard Sigmoid激活函数。
  4. Hard sigmoid定义为:
  5. .. math::
  6. \text{hsigmoid}(x_{i}) = max(0, min(1, \frac{x_{i} + 3}{6})),
  7. 其中,:math:`x_i` 是输入Tensor的一个元素。
  8. 输入:
  9. - **input_x** (Tensor):Hard Sigmoid的输入。shape为:math:`(N,*)`,其中:math:`*`表示任意的附加维度。
  10. 输出:
  11. Tensor,数据类型和shape与 `input_x` 的相同。
  12. 异常:
  13. TypeError:`input_x`不是tensor。
  14. 支持平台:
  15. ``Ascend`` ``GPU`` ``CPU``
  16. 示例:
  17. >>> x = Tensor(np.array([-1, -2, 0, 2, 1]), mindspore.float16)
  18. >>> hsigmoid = nn.HSigmoid()
  19. >>> result = hsigmoid(x)
  20. >>> print(result)
  21. [0.3333 0.1666 0.5 0.8335 0.6665]