Method for reducing calculation amount by splicing concat in application

By integrating the concat parameters into the previous layer, the calculation process of splicing concat is simplified, and the problem of increasing computational volume caused by splicing concat layer is solved, achieving time saving and processing efficiency improvement.

CN119167285APending Publication Date: 2024-12-20INGENIC SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310734449.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-20
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

When splicing concat as a layer, it increases the computational amount, consumes loading data time, intermediate calculation time and data storage time, especially during unsigned 8 bits converted into floating point calculation and saturation processing.

Method used

Integrate the parameters of concat into the previous layer, and implement the calculation of spliced ​​concat through formula (17), simplifying the processing flow and avoiding additional calculation and storage time.

Benefits of technology

It significantly reduces the calculation amount, avoids the time consumption of splicing concat layers, improves processing efficiency, and is suitable for relu, prelu and leakrelu activation functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119167285A_ABST
    Figure CN119167285A_ABST
Patent Text Reader

Abstract

The invention provides a method for reducing calculation amount by splicing concat in application. A model formula: # imgabs0 # x is a calculation result before a function is activated; quantification is carried out according to parameters m and n given by a model and parameters a1, a2 and b1 of an activation function, and the method comprises the steps that S1, each input data feature has a set of parameters m and n, namely parameters mi and ni; the ith input data feature is set to have mi and ni, the initial i is equal to 0, and the number of the input feature is N; s2, according to the parameters mi and ni, the clipx range is calculated as [p, q], p = max (ni, 0), q = min (mi * 255 + ni, 255), and p and q are integers; s3, the mi * a1 (x + b1) + ni and the mi * a2 (x + b1) + ni are changed into ma1 (x + b1) + ni and ma2 (x + b1) + n, ma1 = mi * a1, and ma2 = mi * a2; s4, p, q, ma1 and ma2 are substituted into a formula (17) with # imgabs1 # S5, data x before processing of each data calculation activation function in the feature is calculated, and f4 (x) is calculated according to a formula (18); s6, if i + = 1 and i is less than N, repeating the steps S2 to S5; when i = = N, all data processing is completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of neural networks, and particularly relates to a method for reducing the amount of calculation by concat in an application. Background Art

[0002] Concat is a preprocessing or a layer of processing. Concat implements the concatenation of input data. It connects two or more inputs to one output (according to the given dimension axis. Note that in addition to the specified dimension axis, the sizes of other dimensions of the concat inputs must be consistent). When concatenating, since it is quantized input data, the input data needs to be processed. Generally, it needs to be multiplied by a number, added by a number, multiplied by a number, added by a number, and finally concatenated.

[0003] Concat is used as a layer of processing. Let the first set of input data be input1, with width and height of w1 and h1, channel depth of ic1, the bias added to each data for preprocessing is in_offset1, and the coefficient is in_scale1; the second set of data is input2, with width and height of w2 and h2, channel depth of ic2, the bias added to each data for preprocessing is in_offset2, and the coefficient is in_scale2. The bias required for output is out_offset, and the coefficient is out_scale. The direction of concat is along the depth direction conat.

[0004] Let x 1_t is one of the input data, and the corresponding processed data is y 1_i ;x 2_i is one of the input data, and the corresponding processed data is y 2_i .

[0005] y 1_i =clip{[(x 1_i -in_offset1)×in_scale1]×out_scale+out_offset}......(1)

[0006] y 2_i =clip{[(x 2_i -in_offset2)×in_scale2]×out_scale+out_offset}......(2)

[0007] The general pattern is:

[0008] y k_i =clip{[(x k_i -in_offset k)×in_scale k ]×out_scale+out_offset}......(3)

[0009] Where k∈N, i∈M, N is the number of input data groups, and M is the number of data in each group. clip is a saturation processing function that performs unsigned 8-bit saturation processing on the generated data. Values ​​less than 0 are treated as 0, and values ​​greater than 0 are treated as 255. Input data x k_i and k_i It is an unsigned 8-bit data. During use, it is converted into floating-point data. k 、in_scale k And out_scale, out_offset are all floating point numbers.

[0010] Usually, concat is processed as a layer, which consumes the time of loading data, intermediate calculation time and data saving time, thus increasing the time. The amount of calculation here is converted from unsigned 8 bits to floating points, floating point calculation is performed, and the calculation result is clipped to generate unsigned 8-bit results, which is relatively large. Summary of the invention

[0011] In order to solve the above problems, the purpose of this application is to remove the concat layer and integrate the concat parameters into the previous layer to reduce the time of the concat layer to almost 0. Using formula (17), through algorithm design, the concat is spliced ​​to the previous layer to achieve the purpose of reducing the time.

[0012] Specifically, the present invention provides a method for reducing the amount of calculation by concatenating concat in an application. The concatenating concat is to integrate the concat parameters into the previous layer calculation. The model used is expressed as the following formula (17). At the same time, the parameters need to be preprocessed to synthesize new parameters. The model formula in the method is:

[0013]

[0014] Where x is the calculation result before the activation function, b1 is the bias before concat processing, a1 and a2 are the coefficients before concat processing, that is, the coefficients in quantization, and n and m are the coefficients of concat processing, that is, the coefficients in quantization;

[0015] For any n and m, clip x The range is [max(n, 0), min(m×255+n, 255)], and n and m×255+n are rounded to the nearest integer, where m and n are the m in the quantization. k 、nk ,mk=in_scale k ×out_scale,n k =out_offset-in_offset k ×in_scale k ×out_scale, biased to in_offset k , the coefficient is in_scale k , the required bias for output is out_offset, and the coefficient is out_scale;

[0016] According to the parameters m and n given by the model, and the parameters a1, a2, b1 of the activation function, relevant quantization is performed, including the following steps:

[0017] S1, each input data feature has a set of parameters m and n, that is, parameter m i and n i ; Assume the i-th input data f3ature, that is, there are m i and n i , initially i=0, the number of input features is N;

[0018] S2, according to the parameter m given by the model i and n i , calculate clip x The range is [p, q], where p = max(n i , 0), q = min (m i ×255+n i , 255), p and q are both integers;

[0019] S3, m i ×al(x+b1)+n i and m i ×a2(x+b1)+n i Changes to mal(x+b1)+n i and ma2(x+b1)+n, where ma1=m i ×a1,ma2=m i ×a2;

[0020] S4, substitute p, q, ma1, ma2 in steps S2 and S3 into formula (17), and we have

[0021]

[0022] Among them clip x The range of is [p, q];

[0023] S5, calculate the data x before the activation function is processed for each data in the feature, and calculate f4(x) according to formula (18);

[0024] S6, i+=1, and i is less than N, repeat steps S2 to S5; when i==N, all data processing is completed.

[0025] The model formula (17) is obtained by the following steps: In concat, each data in each group is preprocessed, which is expressed as formula (4):

[0026] y k_i =clip{[(x k_i -in_offset k )×in_scale k ]×out_scale+out_offset}......(4)

[0027] Where k∈N, i∈M, N is the number of input data groups, M is the number of data in each group; the input data is x k_i , biased to in_offset k , the coefficient is in_scale k , the required bias for output is out_offset, the coefficient is out_scale, and the output data is y k _i; clip is a saturation processing function, which performs unsigned 8-bit saturation processing on the generated data. Values ​​less than 0 are treated as 0, and values ​​greater than 0 are treated as 255.

[0028] Simplifying formula (4), we have

[0029] f k_i (x) = m k ·y k_i +n k ......(5)

[0030] Where m k = in_scale k ×out_scale

[0031] n k =out_offset-in_offset k ×in_scale k ×out_scale,

[0032] The quantization process of the activation function is to multiply a scale and add an offset. Currently, these two data are floating point data. The scale is greater than 0 and less than 1, and the offset can be positive or negative.

[0033] Assume that the activation functions in the quantization processing function are prelu and leakrelu, the input data is x, the bias is b1, the coefficients are a1 and a2, and the formula is as follows:

[0034]

[0035] Where x is the calculation result before the activation function;

[0036] Saturate the clip.

[0037]

[0038] Where x is the calculation result before the activation function;

[0039] The processing of concat,

[0040] f3(x)=m·f2(x)+n......(8)

[0041] Where x is the calculation result before the activation function.

[0042] Where m and n are the m in quantization k 、n k

[0043] The saturation processing function of clip0-255 has

[0044] f3(x)=chp[m·f2(x)+n]......(9)

[0045] Where x is the calculation result before the activation function;

[0046] Combining equations (8) and (9) we have

[0047]

[0048] Where x is the calculation result before the activation function;

[0049] Substituting (6) into (10), we get

[0050]

[0051] Where x is the calculation result before the activation function;

[0052] Since both clips are saturated from 0 to 255 and their minimum values ​​are both 0, there is monotonicity between clip[a1(x+b1)] and clip[a2(x+b1)], so m can be merged with a1 and a2, i.e. m×a1, m×a2; after merging, the range of the innermost clip will change to [0, m×255]. Let the new saturation function be clip m , the saturation function with a saturation range of [0, 255] is clip 255 have

[0053]

[0054] Where x is the calculation result before the activation function;

[0055] Case 1, when n≤0 if 0<m≤1, then clip m The maximum value of clip is less than or equal to 255; 255 clip m Merge to clip x In, clip x The range is [0, m×255+n]. Since a negative number is added to the result of saturation processing, the maximum value of the saturation result is added with a negative number.

[0056] If this negative number is moved into the saturation processing function clip, m×a1(x+b1) or m×a2(x+b1) will be reduced.

[0057] For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to -n, they will be less than or equal to 0, through clip x After merging, they are all 0, which is the same result as before merging, both are 0;

[0058] For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to m×255, add n and use clip x After merging, they are all m×255+n; the same as before merging; so after merging, only the maximum value of saturation processing will be affected, so there is

[0059]

[0060] Where x is the calculation result before the activation function;

[0061] Case 2, when n≤0 if m>1, then clip m The maximum value of clip is less than or equal to m×255+n; 255 clip m Merge to clip x In, clip xThe range is [0, min(m×255+n, 255)]. Since a negative number is added to the result of saturation processing, the maximum value of the saturation result is added with a negative number.

[0062] If this negative number is moved into the saturation processing function, m×a1(x+b1) or m×a2(x+b1) will be reduced.

[0063] For values ​​of m×al(x+b1) or m×a2(x+b1) less than or equal to -n, they will be less than or equal to 0, through clip x After merging, they are all 0, which is the same result as before merging, both are 0;

[0064] For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to m×255, add n and use clip 255 After merging, it is min(m×255+n, 255); so after merging, it will only affect the maximum value of saturation processing, so there is

[0065]

[0066] Where x is the calculation result before the activation function;

[0067] Case 3, when n>0 if 0<m≤1, then clip m The maximum value of clip is less than or equal to m×255; 255 clip m Merge to clip x In, clip x The range is [n, min(m×255+n, 255)]. Since a positive number is added to the result of saturation processing, the maximum value of the saturation result increases.

[0068] If this positive number is moved into the saturation processing function, m×a1(x+b1) or m×a2(x+b1) will be increased. For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to n, they will be less than or equal to n. x After merging, they are all n, which is the same as the result before merging.

[0069] For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to m×255, add n and use clip 255 After merging, they are all min(m×255+n, 255); the same as before merging; so after merging, only the maximum and minimum values ​​of saturation processing will be affected, so there are

[0070]

[0071] Where x is the calculation result before the activation function;

[0072] Case 4, when n>0 if m>1, then clip m The maximum value of clip is less than or equal to 255; 255 clip m Merge to clip x In, clip x The range is [n, 255]. Since a negative number is added to the result of saturation processing, the maximum value of the saturation result is added with a negative number.

[0073] If this positive number is moved into the saturation processing function, m×a1(x+b1) or m×a2(x+b1) will be increased.

[0074] For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to n, they will be less than or equal to n, through clip x After merging, they are all n, and the results are the same as before merging, which are all n;

[0075] For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to 255, add n and use clip 255 After merging, they are all 255; the same as before merging; so after merging, only the minimum value of saturation processing will be affected, so there is

[0076]

[0077] Where x is the calculation result before the activation function.

[0078] The method for reducing the amount of calculation is to multiply the number by scale or scale1 and scale2 with positive and negative signs in the final calculation in the convolution quantization, and then use clip to cut the number to 0-255 and take the integer.

[0079] The use of data in the method: when concatenating concat data, all processing can be achieved by using it in multiple input modes; the output result is only used for one layer. If there are multiple layers, it is necessary to process it once according to the original processing method, save the result, and then process it again according to the method as claimed in the above claims, and save the generated result again. Different layers use different results.

[0080] The method is suitable for relu activation function, prelu activation function and leakrelu activation function.

[0081] Therefore, the advantages of the present application are: the present method is simple, and avoids processing concat as a layer, that is, avoids this layer consuming data loading time, intermediate calculation time and data saving time, thereby saving time. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.

[0083] Figure 1 is a schematic diagram of the process of this method.

[0084] Figure 2 It is a flowchart without concat.

[0085] Figure 3 It is a flowchart of concat that integrates the concat parameters into the previous layer of calculation. DETAILED DESCRIPTION

[0086] In order to more clearly understand the technical content and advantages of the present invention, the present invention is now further described in detail in conjunction with the accompanying drawings.

[0087] The present application relates to a method for reducing the amount of calculation by concatenating in an application. The method is suitable for relu activation function, prelu and leakrelu or some improved methods thereof.

[0088] There is no concat process such as Figure 2 The concat concatenation is to integrate the concat parameters into the previous layer of calculation. The process is as follows Figure 3 As shown, the model formula (17) used is a formula created from scratch, and some parameters need to be preprocessed to synthesize new parameters.

[0089] Specifically, the method to reduce the amount of calculation is:

[0090] 1) In the quantization of convolution, the final calculation is usually multiplied by scale (or scale1, scale2 with positive or negative value), and then clipped to 0-255 and taken as an integer.

[0091] 2) In concat, each data in each group is preprocessed, that is, formula (4):

[0092] y k_i =clip{[(x k_i -in_offset k )×in_scale k ]×out_scale+out_offset}......(4)

[0093] Where k∈N, i∈M, N is the number of input data groups, and M is the number of data in each group. The input data is xk_i , the bias is in_offset2, the coefficient is in_scale2, the bias required for output is out_offset, the coefficient is out_scale, and the output data is y k_i . clip is a saturation processing function, which performs unsigned 8-bit saturation processing on the generated data. Values ​​less than 0 are treated as 0, and values ​​greater than 0 are treated as 255.

[0094] Simplifying formula (4), we have

[0095] f k_i (x) = m k ·y k_i +n k ......(5)

[0096] Where m k = in_scale k ×out_scale

[0097] n k =out_offset-in_offset k ×in_Scale k ×out_scale

[0098] The quantization process of the activation function is to multiply a scale and then add an offset. Currently, these two data are floating-point data. The scale is greater than 0 and less than 1, and the offset can be positive or negative.

[0099] Assume that the activation functions in the quantization processing function are prelu and leakrelu, the input data is x, the bias is b1, the coefficients are a1, and a2 have the following formula:

[0100]

[0101] Where x is the calculation result before the activation function.

[0102] Saturate the clip.

[0103]

[0104] Where x is the calculation result before the activation function.

[0105] concat processing.

[0106] f3(x)=m·f2(x)+n......(8)

[0107] Where x is the calculation result before the activation function.

[0108] Where m and n are the m in quantization k 、n k

[0109] Clip 0-255 saturation processing function,

[0110] f3(x)=chip[m·f2(x)+n]......(9)

[0111] Where x is the calculation result before the activation function.

[0112] Combining equations (8) and (9) we have

[0113]

[0114] Where x is the calculation result before the activation function.

[0115] Substituting (6) into (10), we get

[0116]

[0117] Where x is the calculation result before the activation function.

[0118] Since both clips are saturated from 0 to 255, and their minimum values ​​are both 0, there is monotonicity between clip[a1(x+b1)] and clip[a2(x+b1)], so m can be merged with a1 and a2, i.e. m×a1, m×a2. After the merger, the range of the innermost clip will change to [0, m×255]. Let the new saturation function be clip m , the saturation function with a saturation range of [0, 255] is clip 255 have

[0119]

[0120] Where x is the calculation result before the activation function.

[0121] 1], n≤0 if 0<m≤1, then clip m The maximum value of clip is less than or equal to 255. 255 clip m Merged into clp x In, clip x The range is [0, m×255+n]. Since a negative number is added to the result of the saturation process, the maximum value of the saturation result is added with a negative number. If this negative number is moved into the saturation process function, m×a1(x+b1) or m×a2(x+b1) will be reduced. For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to -n, they will be less than or equal to 0. xAfter merging, they are all 0, the same result as before merging, all are 0. For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to m×255, after adding n, through clip x After merging, they are all m×255+n; the same as before merging. So after merging, only the maximum value of saturation processing will be affected, so there is

[0122]

[0123] Where x is the calculation result before the activation function.

[0124] 2], n≤0 if m>1, then clip m The maximum value of clip is less than or equal to m×255+n. 255 clip m Merge to clip x In, clip x The range is [0, min(m×255+n, 255)]. Since a negative number is added to the result of the saturation process, the maximum value of the saturation result is added with a negative number. If this negative number is moved into the saturation process function, m×a1(x+b1) or m×a2(x+b1) will be reduced. For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to -n, they will be less than or equal to 0. x After merging, they are all 0, the same result as before merging, all are 0. For values ​​m×al(x+b1) or m×a2(x+b1) greater than or equal to m×255, after adding n, through clip 255 After merging, it is min(m×255+n, 255). So after merging, it will only affect the maximum value of saturation processing, so there is

[0125]

[0126] Where x is the calculation result before the activation function.

[0127] 3], n>0 if 0<m≤1, then clip m The maximum value of clip is less than or equal to m×255. 255 clip m Merge to clip x In the clipx function, the range is [n, min(m×255+n, 255)]. Since a positive number is added to the result of the saturation process, the maximum value of the saturation result increases. If this positive number is moved into the saturation process function, m×a1(x+b1) or m×a2(x+b1) will increase. For values ​​of m×al(x+b1) or m×a2(x+b1) that are less than or equal to n, they will be less than or equal to n. xAfter adding n, the result is the same as before merging, which is n. For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to m×255, after adding n, through clip 255 After merging, they are all min(m×255+n, 255); the same as before merging. So after merging, only the maximum and minimum values ​​of saturation processing will be affected, so there is

[0128]

[0129] Where x is the calculation result before the activation function.

[0130] 4], n>0 if m>1, then clip m The maximum value of clip is less than or equal to 255. 255 clip m Merge to clip x In, clip x The range is [n, 255]. Since a negative number is added to the result of the saturation process, the maximum value of the saturation result is added with a negative number. If this positive number is moved into the saturation process function, m×a1(x+b1) or m×a2(x+b1) will be increased. For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to n, they will be less than or equal to n. x After adding n, the result is n, which is the same as before merging. For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to 255, after adding n, the clip 255 After merging, they are all 255; the same as before merging. So after merging, only the minimum value of saturation processing will be affected, so there is

[0131]

[0132] Where x is the calculation result before the activation function.

[0133] In summary: for any n and m, clip x The range is [max(n, 0), min(m×255+n, 255)], and n and m×255+n are rounded to the nearest integer. The formula is:

[0134]

[0135] Among them, x is the calculation result before the activation function, b1 is the bias before concat processing, a1 and a2 are the coefficients before concat processing, and n and m are the coefficients of concat processing.

[0136] 2. Algorithm design.

[0137] According to the parameters m and n given by the model, and the parameters a1, a2, b1 of the activation function, relevant quantitative calculations are performed. The specific implementation is as follows Figure 1 As shown:

[0138] S1, each input data feature has a set of parameters m and n, that is, parameter m i and n i . Assume that the i-th input data feature has m i and n i , initially i=0, the number of input features is N.

[0139] S2, according to the parameter m given by the model i and n i , calculate clip x The range is [p, q], where p = max(n i , 0), q = min (m i ×255+n i , 255), p and q are both integers;

[0140] S3, m i ×a1(x+b1)+n i and m i ×a2(x+b1)+n i Changes to ma1(x+b1)+n i and ma2(x+b1)+n, where ma1=m i ×a1,ma2=m i ×a2.

[0141] S4, substitute p, q, ma1, ma2 in S2 and S3 into formula (17), and we have

[0142]

[0143] where clp x The range of is [p, q].

[0144] S5, calculates the data x before the activation function is processed for each data in the feature, and calculates f4(x) according to formula (18).

[0145] S6, i+=1, and i is less than N, repeat S2-S5. When i==N, all data processing is completed.

[0146] 3. Use of data.

[0147] When using concat data, use it in multiple input modes. This is the conventional way of using it. All processing can be achieved. The output result is only used for one layer. If there are multiple layers, you need to process it once according to the original processing method, save the result, and then process it again according to the above method, and save the generated result again. Different layers use different results.

[0148] To sum up, the most important thing among all is the model formula. If the model formula is used directly, it will not be possible to explain how the formula is obtained, what the parameters mean, why they are merged in this way, and why the data remains unchanged after the merger. Therefore, here is how the model formula is obtained. The model formula here is the process of mathematical modeling. Mathematical modeling is a process from scratch and has adaptive conditions, which is the method currently invented. The model formula is also from scratch. Then the model formula is used to implement "algorithm design", which is the process method of using the formula.

[0149] The concat merging process is to observe a large amount of data and guess that it can be merged into the previous layer, that is, splicing. It is speculated that there is a formula that can be realized. The parameters in the formula come from the concat of the previous layer and the current layer, which can merge the parameters and splice the two layers into one layer. Various parameter situations are considered and analyzed to obtain the model formula.

[0150] Currently, the trained model cannot be spliced ​​together without any errors, so it needs strict proof before it can be used, otherwise it will cause errors and reduce the accuracy.

[0151] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for concat in an application to reduce the amount of calculation, characterized in that: The concat method integrates the concat parameters into the previous layer calculation. The model used is expressed as the following formula (17). At the same time, the parameters need to be preprocessed to synthesize new parameters. The model formula in the method is: Where x is the calculation result before the activation function, b1 is the bias before concat processing, a1 and a2 are the coefficients before concat processing, that is, the coefficients in quantization, and n and m are the coefficients of concat processing, that is, the coefficients in quantization; For any n and m, clip x The range is [max(n, 0), min(m×255+n, 255)], and n and m×255+n are rounded to the nearest integer, where m and n are the m in the quantization. k 、n k , m k = in_scale k ×out_scale,n k =out_offset-in_offset k ×in_scale k ×out_scale, biased by in_offset k , the coefficient is in_scale k , the required bias for output is out_offset, and the coefficient is out_scale; According to the parameters m and n given by the model, and the parameters a1, a2, b1 of the activation function, relevant quantization is performed, including the following steps: S1, each input data feature has a set of parameters m and n, that is, parameter m i and n i ; Assume the i-th input data feature, that is, there are m i and n i , initially i=0, the number of input features is N; S2, according to the parameter m given by the model i and n i , calculate clip x The range is [p, q], where p = max(n i , 0), q = min (m i ×255+n i , 255), p and q are both integers; S3, m i ×a1(x+bl)+n i and m i ×a2(x+bl)+n i Changes to mal(x+b1)+n i and ma2(x+b1)+n, where mal=mi×al, ma2=m i ×a2; S4, substitute p, q, maxl, ma2 in steps S2 and S3 into formula (17), and we have Among them clip x The range of is [p, q]; S5, calculate the data x before the activation function is processed for each data in the feature, and calculate f4(x) according to formula (18); S6, i+=1, and i is less than N, repeat steps S2 to S5; when i==N, all data processing is completed.

2. The method for reducing the amount of calculation by concat in an application according to claim 1, characterized in that: The model formula (17) is obtained by the following steps: In concat, each data in each group is preprocessed, which is expressed as formula (4): y k_i =clip{[(x k_i -in_offset k )×in_scale k ]×out_scale+out_offset}……(4) Where k∈N, i∈M, N is the number of input data groups, M is the number of data in each group; the input data is x k_i , biased to in_offset k , the coefficient is in_scale k , the required bias for output is out_offset, the coefficient is out_scale, and the output data is y k_i ; clip is a saturation processing function, which performs unsigned 8-bit saturation processing on the generated data. Values ​​less than 0 are treated as 0, and values ​​greater than 0 are treated as 255; Simplifying formula (4), we have f k_i (x)=m k ·y k_i +n k ……(5) Where m k = in_scale k ×out_scale n k =out_offset-in_offset k ×in_scale k ×out_scale, The quantization process of the activation function is to multiply a scale and add an offset. Currently, these two data are floating-point data. The scale is greater than 0 and less than 1, and the offset can be positive or negative. Assume that the activation functions in the quantization processing function are prelu and leakrelu, the input data is x, the bias is b1, the coefficients are a1 and a2, and the formula is as follows: Where x is the calculation result before the activation function; Saturate the clip. Where x is the calculation result before the activation function; The processing of concat, f3(x)=m·f2(x)+n……(8) Where x is the calculation result before the activation function. Where m and n are the m in quantization k 、n k The saturation processing function of clip0-255 has f3(x)=clip[m·f2(x)+n]......(9) Where x is the calculation result before the activation function; Combining equations (8) and (9) we have Where x is the calculation result before the activation function; Substituting (6) into (10), we get Where x is the calculation result before the activation function; Since both clips are saturated from 0 to 255 and their minimum values ​​are both 0, there is monotonicity between clip[a1(a+b1)] and clip[a2(a+b1)], so m can be merged with a1 and a2, i.e. m×a1, m×a2; after the merger, the range of the innermost clip will change to [0, m×255]. Let the new saturation function be clip m , the saturation function with a saturation range of [0, 255] is clip 255 have Where x is the calculation result before the activation function; Case 1, when n≤0 if 0<m≤1, then clip m The maximum value of clip is less than or equal to 255; 255 clip m Merge to clip x In,clip x The range is [0, m×255+n]. Since a negative number is added to the result of saturation processing, the maximum value of the saturation result is added with a negative number. If this negative number is moved into the saturation processing function clip, m×a1(x+b1) or m×a2(x+b1) will be reduced. For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to -n, they will be less than or equal to 0, through clip x After merging, they are all 0, which is the same result as before merging, both are 0; For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to m×255, add n and use clip x After merging, they are all m×255+n; the same as before merging; so after merging, only the maximum value of saturation processing will be affected, so there is Where x is the calculation result before the activation function; Case 2, when n≤0 if m>1, then clip m The maximum value of clip is less than or equal to m×255+n; 255 clip m Merge to clip x In,clip x The range is [0, min(m×255+n, 255)]. Since a negative number is added to the result of saturation processing, the maximum value of the saturation result is added with a negative number. If this negative number is moved into the saturation processing function, m×a1(x+b1) or m×a2(x+b1) will be reduced. For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to -n, they will be less than or equal to 0, through clip x After merging, they are all 0, which is the same result as before merging, both are 0; For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to m×255, add n and use clip 255 After merging, it is min(m×255+n, 2555); so after merging, it will only affect the maximum value of saturation processing, so there is Where x is the calculation result before the activation function; Case 3, when n>0 if 0<m≤1, then clip m The maximum value of clip is less than or equal to m×255; 255 clip m Merge to clip x In,clip x The range is [n, min(m×255+n, 255)]. Since a positive number is added to the result of saturation processing, the maximum value of the saturation result increases. If this positive number is moved into the saturation processing function, m×a1(x+b1) or m×a2(x+b1) will be increased. For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to n, they will be less than or equal to n, through clip x After merging, they are all n, and the results are the same as before merging, which are all n; For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to m×255, add n and use clip 255 After merging, they are all min(m×255+n, 255); the same as before merging; so after merging, only the maximum and minimum values ​​of saturation processing will be affected, so there is Where x is the calculation result before the activation function; Case 4, when n>0 if m>1, then clip m The maximum value of clip is less than or equal to 255; 255 , clip m Merge to clip x In,clip x The range is [n, 255]. Since a negative number is added to the result of saturation processing, the maximum value of the saturation result is added with a negative number. If this positive number is moved into the saturation processing function, m×a1(x+b1) or m×a2(x+b1) will be increased. For values ​​of m×a1(x+b1) or m×a2(x+b1) less than or equal to n, they will be less than or equal to n, through clip x After merging, they are all n, and the results are the same as before merging, which are all n; For values ​​m×a1(x+b1) or m×a2(x+b1) greater than or equal to 255, add n and use clip 255 After merging, they are all 255; the same as before merging; so after merging, only the minimum value of saturation processing will be affected, so there is Where x is the calculation result before the activation function.

3. The method for reducing the amount of calculation by concat in an application according to claim 1, characterized in that: The method for reducing the amount of calculation is to multiply the number by scale or scale1 and scale2 with positive and negative signs in the final calculation in the convolution quantization, and then use clip to cut the number to 0-255 and take the integer.

4. The method for reducing the amount of calculation by concat in an application according to claim 1, characterized in that: The use of data in the method: when concatenating concat data, all processing can be achieved by using it in multiple input modes; the output result is only used for one layer. If there are multiple layers, it is necessary to process it once according to the original processing method, save the result, and then process it again according to the method as claimed in the above claims, and save the generated result again. Different layers use different results.

5. The method for reducing the amount of calculation by concat in an application according to claim 1, characterized in that: The method is suitable for relu activation function, prelu activation function and leakrelu activation function.