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



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

    .. math::

        dst_i = src_i \cdot scale_i + bias_i

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

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

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

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

.. c:function:: void i8_scalefusion_s(int8_t* src_data, int8_t* dst_data, int length, float* scale, float* bias, int core_mask)
.. c:function:: void i16_scalefusion_s(int16_t* src_data, int16_t* dst_data, int length, float* scale, float* bias, int core_mask)
.. c:function:: void i32_scalefusion_s(int* src_data, int* dst_data, int length, float* scale, float* bias, int core_mask)
.. c:function:: void hp_scalefusion_s(half* src_data, half* dst_data, int length, half* scale, half* bias, int core_mask)
.. c:function:: void fp_scalefusion_s(float* src_data, float* dst_data, int length, float* scale, float* bias, int core_mask)
.. c:function:: void dp_scalefusion_s(double* src_data, double* dst_data, int length, double* scale, double* bias, int core_mask)

    **C调用示例：**

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

        //FT78NE示例
        #include <stdio.h>
        #include <scalefusion.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_scalefusion_s( input0, output, length, scale, bias, core_mask);
            return 0;
        }


**私有存储版本:**

.. c:function:: void i8_scalefusion_p(int8_t* src_data, int8_t* dst_data, int length, float* scale, float* bias)
.. c:function:: void i16_scalefusion_p(int16_t* src_data, int16_t* dst_data, int length, float* scale, float* bias)
.. c:function:: void i32_scalefusion_p(int* src_data, int* dst_data, int length, float* scale, float* bias)
.. c:function:: void hp_scalefusion_p(half* src_data, half* dst_data, int length, half* scale, half* bias)
.. c:function:: void fp_scalefusion_p(float* src_data, float* dst_data, int length, float* scale, float* bias)
.. c:function:: void dp_scalefusion_p(double* src_data, double* dst_data, int length, double* scale, double* bias)


    **C调用示例：**

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

        //FT78NE示例
        #include <stdio.h>
        #include <scalefusion.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_scalefusion_p( input0, output, length, scale, bias);
            return 0;
        }

