mindspore.ops.relu
==================

.. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/r2.3.1/resource/_static/logo_source.svg
    :target: https://gitee.com/mindspore/mindspore/blob/r2.3.1/docs/api/api_python/ops/mindspore.ops.func_relu.rst
    :alt: 查看源文件


.. py:function:: mindspore.ops.relu(input)

    对输入Tensor逐元素计算线性修正单元激活函数(Rectified Linear Unit)值。

    返回 :math:`\max(input,\  0)` 的值。负值神经元将被设置为0,正值神经元将保持不变。

    .. math::
        ReLU(input) = (input)^+ = \max(0, input)

    ReLU激活函数图:

    .. image:: ../images/ReLU.png
        :align: center

    参数:
        - **input** (Tensor) - 输入Tensor。

    返回:
        Tensor,其shape和数据类型与输入一致。

    异常:
        - **TypeError** - `input` 的数据类型不是数值型。
        - **TypeError** - `input` 不是Tensor。