ScaleFusion
=================



    传入一个数组，逐元素乘上因数，并加上偏置的值后输出。

    .. math::

        dst_i = src_i \cdot scale_i + bias_i

    输入：
        - **src_data** - 输入数据地址。
        - **scale** - 缩放因子数组首地址。
        - **bias** - 偏置数组首地址。
        - **length** - 计算长度。
        - **core_mask** - 核掩码（仅适用于共享存储版本）。

    输出：
        - **dst_data** - 计算结果地址。

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

    .. note::
        - FT78NE 支持int8, int16, int32, fp32, fp64
        - MT7004 支持fp16, fp32, int16, int32
        
**共享存储版本:**

.. c:function:: void i8_scale_fusion_s(int8_t* src_data, int* scale, int* bias, int8_t* dst_data, int length, int core_mask)
.. c:function:: void i16_scale_fusion_s(int16_t* src_data, int16_t* scale, int16_t* bias, int16_t* dst_data, int length, int core_mask)
.. c:function:: void i32_scale_fusion_s(int* src_data, int* scale, int* bias, int* dst_data, int length, int core_mask)
.. c:function:: void hp_scale_fusion_s(half* src_data, half* scale, half* bias, half* dst_data, int length, int core_mask)
.. c:function:: void fp_scale_fusion_s(float* src_data, float* scale, float* bias, float* dst_data, int length, int core_mask)
.. c:function:: void dp_scale_fusion_s(double* src_data, double* scale, double* bias, double* dst_data, int length, int core_mask)

    **C调用示例：**

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

        //FT78NE示例
        #include <stdio.h>
        #include <scale_fusion.h>
        
        int main(int argc, char* argv[]) {
            float *input0 = (float *)0xA0000000;   //input在DDR空间
            float *output = (float *)0xC0000000;
            float *scale = (float *)0xB0000000;   //scale在DDR空间
            float *bias = (float *)0xB1000000;    //bias在DDR空间
            int length = 1000;
            int core_mask = 0xff;
            fp_scale_fusion_s( input0, scale, bias, output, length, core_mask);
            return 0;
        }


**私有存储版本:**

.. c:function:: void i8_scale_fusion_p(int8_t* src_data, int8_t* scale, int8_t* bias, int8_t* dst_data, int length)
.. c:function:: void i16_scale_fusion_p(int16_t* src_data, int16_t* scale, int16_t* bias, int16_t* dst_data, int length)
.. c:function:: void i32_scale_fusion_p(int* src_data, int* scale, int* bias, int* dst_data, int length)
.. c:function:: void hp_scale_fusion_p(half* src_data, half* scale, half* bias, half* dst_data, int length)
.. c:function:: void fp_scale_fusion_p(float* src_data, float* scale, float* bias, float* dst_data, int length)
.. c:function:: void dp_scale_fusion_p(double* src_data, double* scale, double* bias, double* dst_data, int length)


    **C调用示例：**

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

        //FT78NE示例
        #include <stdio.h>
        #include <scale_fusion.h>
        int main(int argc, char* argv[]) {
            float *input0 = (float *)0x10810000;   //input在L2空间
            float *output = (float *)0x10820000;
            float *scale = (float *)0x10830000;   //scale在L2空间
            float *bias = (float *)0x10840000;    //bias在L2空间
            int length = 1000;
            fp_scale_fusion_p(input0, scale, bias, output, length);
            return 0;
        }
