PReLUFusion
=================

对输入数组逐元素执行 PReLU 激活函数。对于每个元素，若小于等于 0，则乘以斜率参数 slope，否则保持原值。

.. math::

    \text{dst}_i =
    \begin{cases}
        \text{src}_i \cdot \text{slope}, & \text{if } \text{src}_i \le 0 \\
        \text{src}_i, & \text{otherwise}
    \end{cases}

输入：
    - **src_data** - 输入数据地址。
    - **slope** - PReLU 斜率参数。
    - **start** - 起始索引。
    - **end** - 结束索引。
    - **core_mask** - 核掩码（仅适用于共享存储版本）。

输出：
    - **dst_data** - 输出数据地址。

支持平台：
    ``FT78NE``
    ``MT7004``

.. note::
    - FT78NE 支持fp, int8
    - MT7004 支持hp, fp

**共享存储版本:**

.. c:function:: void fp_prelufusion_s(float* src_data, float* dst_data, float slope, int start, int end, int core_mask)
.. c:function:: void hp_prelufusion_s(half* src_data, half* dst_data, half slope, int start, int end, int core_mask)
.. c:function:: void i8_prelufusion_s(int8_t* src_data, int8_t* dst_data, float slope, int start, int end, int core_mask)

**C调用示例：**

.. code-block:: c
    :linenos:
    :emphasize-lines: 12

    #include <stdio.h>
    #include <prelu_fusion.h>

    int main() {
        float *src = (float *)0xA0000000;        // 输入在DDR空间
        float *dst = (float *)0xC0000000;
        float slope = 0.25;
        int start = 0;
        int end = 999;
        int core_mask = 0xff;

        fp_prelufusion_s(src, dst, slope, start, end, core_mask);
        return 0;
    }


**私有存储版本:**

.. c:function:: void fp_prelufusion_p(float* src_data, float* dst_data, float slope, int start, int end)
.. c:function:: void hp_prelufusion_p(half* src_data, half* dst_data, half slope, int start, int end)
.. c:function:: void i8_prelufusion_p(int8_t* src_data, int8_t* dst_data, float slope, int start, int end)

**C调用示例：**

.. code-block:: c
    :linenos:
    :emphasize-lines: 11

    #include <stdio.h>
    #include <prelu_fusion.h>

    int main() {
        float *src = (float *)0x10810000;        // 输入在L2空间
        float *dst = (float *)0x10820000;
        float slope = 0.25;
        int start = 0;
        int end = 999;

        fp_prelufusion_p(src, dst, slope, start, end);
        return 0;
    }
