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.ReLUV2.rst 1.0 kB

4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. mindspore.ops.ReLUV2
  2. ====================
  3. .. py:class:: mindspore.ops.ReLUV2()
  4. 线性修正单元激活函数(Rectified Linear Unit activation function)。
  5. 按元素返回 :math:`\max(x,\ 0)` 。特别说明,负数输出值会被修改为0,正数输出不受影响。
  6. .. math::
  7. \text{ReLU}(x) = (x)^+ = \max(0, x),
  8. **输入:**
  9. - **input_x** (Tensor) - 输入Tensor必须是4-D Tensor。
  10. **输出:**
  11. - **output** (Tensor) - 数据类型和shape与 `input_x` 的相同。
  12. - **mask** (Tensor) - 保留输出,无实际意义。
  13. **异常:**
  14. - **TypeError** - `input_x` 不是Tensor。
  15. - **ValueError** - `input_x` 的shape不是4-D。
  16. **支持平台:**
  17. ``Ascend``
  18. **样例:**
  19. >>> input_x = Tensor(np.array([[[[1, -2], [-3, 4]], [[-5, 6], [7, -8]]]]), mindspore.float32)
  20. >>> relu_v2 = ops.ReLUV2()
  21. >>> output, _= relu_v2(input_x)
  22. >>> print(output)
  23. [[[[1. 0.]
  24. [0. 4.]]
  25. [[0. 6.]
  26. [7. 0.]]]]