Data processing method, device, computer equipment and storage medium

Through multiple pairs of truncation threshold quantification and absolute value mean difference selection methods, winograd convolution data is processed, which solves the problems of long calculation time and high energy consumption of large-scale neural network models, and achieves high-efficiency, low-energy consumption computing performance and accuracy. promote.

CN112765537BActive Publication Date: 2024-08-23CAMBRICON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911060464.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-01
Publication Date
2024-08-23
Estimated Expiration
2040-02-07

AI Technical Summary

Technical Problem

In the field of artificial intelligence, the increased complexity of neural network algorithms has resulted in long calculation times and high energy consumption for large-scale models, and traditional quantification methods have resulted in loss of accuracy.

Method used

Multiple pairs of truncation thresholds are used to quantify the data in the winograd convolution process. The quantification accuracy is improved by determining the appropriate truncation threshold, and the truncation threshold is selected using the absolute value mean difference as an evaluation index to reduce computing time and energy consumption.

Benefits of technology

It improves the computing performance and accuracy of winograd convolution, saves computing time and energy consumption, and reduces the loss of quantization accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112765537B
    Figure CN112765537B
Patent Text Reader

Abstract

The present disclosure relates to a data processing method, device, computer equipment and storage medium. The disclosed board includes: a storage device, an interface device and a control device, and an artificial intelligence chip including a data processing device; wherein the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively; the storage device is used to store data; the interface device is used to realize data transmission between the artificial intelligence chip and an external device; the control device is used to monitor the state of the artificial intelligence chip. The data processing method, device, computer equipment and storage medium provided in the embodiments of the present disclosure can improve the accuracy of quantization while saving the operation time of winograd convolution and reducing energy consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, apparatus, computer equipment and storage medium. Background Art

[0002] In the field of artificial intelligence technology, neural network algorithms are a very popular machine learning algorithm recently, and have achieved very good results in various fields, such as image recognition, speech recognition, natural language processing, etc. With the development of neural network algorithms, the complexity of the algorithms is getting higher and higher. In order to improve the recognition, the scale of the model is also gradually increasing. Using GPU and CPU to process these large-scale models takes a lot of computing time and consumes a lot of power. Summary of the invention

[0003] Based on this, it is necessary to provide a data processing method, device, computer equipment and storage medium that can save computing time, reduce energy consumption and improve computing accuracy in response to the above technical problems.

[0004] According to one aspect of the present disclosure, there is provided a data processing method, comprising:

[0005] Determine a pair of truncation thresholds from the multiple pairs of truncation thresholds according to the average of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using the multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value in the data to be quantized;

[0006] Quantizing the data to be quantized according to the determined pair of cutoff thresholds to obtain quantized data;

[0007] Continue to perform winograd convolution processing according to the quantized data to obtain a quantized winograd convolution result;

[0008] Dequantization is performed on the quantized winograd convolution result to obtain a winograd convolution result.

[0009] According to another aspect of the present disclosure, there is provided a data processing device, the device comprising:

[0010] A first determination module determines a pair of truncation thresholds from multiple pairs of truncation thresholds according to the average of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value of the data to be quantized;

[0011] A first quantization module performs quantization processing on the data to be quantized according to the determined pair of truncation thresholds to obtain quantized data;

[0012] A convolution processing module, further performing winograd convolution processing according to the quantized data to obtain a quantized winograd convolution result;

[0013] The dequantization processing module performs dequantization processing on the quantized winograd convolution result to obtain a winograd convolution result.

[0014] According to another aspect of the present disclosure, an artificial intelligence chip is provided, wherein the chip comprises a data processing device as described in any one of the above.

[0015] According to another aspect of the present disclosure, an electronic device is provided, comprising the artificial intelligence chip as described above.

[0016] According to another aspect of the present disclosure, there is provided a board card, the board card comprising: a storage device, an interface device, a control device and an artificial intelligence chip as described above;

[0017] Wherein, the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively;

[0018] The storage device is used to store data;

[0019] The interface device is used to realize data transmission between the artificial intelligence chip and external equipment;

[0020] The control device is used to monitor the status of the artificial intelligence chip.

[0021] According to another aspect of the present disclosure, there is provided an electronic device, comprising:

[0022] processor;

[0023] a memory for storing processor-executable instructions;

[0024] The processor is configured to call the instructions stored in the memory to execute any one of the methods described above.

[0025] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement any one of the aforementioned methods when executed by a processor.

[0026] According to the data processing method, device, computer equipment and storage medium disclosed in the present invention, a pair of truncation thresholds is determined from the multiple pairs of truncation thresholds according to the mean of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using the multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution processing process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value in the data to be quantized; the data to be quantized is quantized according to the determined pair of truncation thresholds to obtain quantized data; winograd convolution processing is continued according to the quantized data to obtain a quantized winograd convolution result; dequantization processing is performed on the quantized winograd convolution result to obtain a winograd convolution result, which can improve the quantization accuracy while saving the operation time of winograd convolution and reducing energy consumption.

[0027] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0029] Figure 1 A flow chart of a data processing method according to an embodiment of the present disclosure is shown.

[0030] Figure 2 A schematic diagram showing determination of a truncation threshold in a data processing method according to an embodiment of the present disclosure is shown.

[0031] Figure 3 A block diagram of a data processing device according to an embodiment of the present disclosure is shown.

[0032] Figure 4 A structural block diagram of a board according to an embodiment of the present disclosure is shown.

[0033] Figure 5 A block diagram of an electronic device 800 according to an embodiment of the present disclosure is shown.

[0034] Figure 6 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0036] It should be understood that the terms "first", "second", "third", "fourth", etc. in the claims, specifications and drawings of the present disclosure are used to distinguish different objects rather than to describe a specific order. The terms "include" and "comprise" used in the specifications and claims of the present disclosure indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.

[0037] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations.

[0038] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0039] Winograd convolution is a convolution acceleration implementation based on the polynomial interpolation algorithm. It performs linear transformation (winograd forward transformation) on the two inputs of the convolution operation: neurons and weights after a certain scale splitting, and then performs positional multiplication on the transformed neurons and weights, and finally performs linear transformation (winograd inverse transformation) on the positional multiplication result again to obtain a convolution result equivalent to the original convolution operation.

[0040] The expression of winograd transformation is as follows:

[0041] For one-dimensional neurons and weights: S = A T ((Gg)⊙(B T d))

[0042] For two-dimensional neurons and weights: S = A T ((GgG T )⊙(B T dB))A

[0043] Among them, g represents the weight, G represents the left multiplication positive transformation matrix corresponding to the weight, G T represents the right-multiplied positive transformation matrix corresponding to the weight, d represents the input neuron, B represents the right-multiplied positive transformation matrix corresponding to the input neuron, B T represents the left-multiplied positive transformation matrix corresponding to the input neuron, ⊙ represents the bitwise multiplication operation, A represents the right-multiplied inverse transformation matrix, A T Represents the left multiplication inverse transformation matrix. For input neurons of different dimensions, there are corresponding B and B T Similarly, for weights of different dimensions, there are corresponding G and G T .

[0044] Replacing the original convolution operation with winograd convolution can bring greater benefits in hardware energy efficiency and computing time, and can also achieve higher neural network performance without increasing or increasing hardware overhead. However, the disadvantages of winograd convolution are still obvious, and a large number of multiplication operations still consume a long computing time during the calculation process.

[0045] In order to solve the above technical problems, the present disclosure provides a data processing method, which can decompose the multiplication operation in the winograd convolution process into addition operation, thereby saving computing time and reducing energy consumption, and quantizing the data in the winograd convolution process to further improve the computing performance.

[0046] Generally speaking, when quantizing data, if a wide range of values ​​is selected, the accuracy of the quantized data will be low, and if the range is too small, too much data will be truncated, resulting in information loss of the data distributed on both sides, where the range of values ​​refers to the numerical range between the minimum truncation threshold and the maximum truncation threshold used to quantize the data. Therefore, it is necessary to find a suitable truncation threshold to quantize the data so that the loss of data quantization is minimized or small. Traditionally, the optimal truncation threshold is determined by the KL divergence (Kullback–Leibler divergence) method, where the KL divergence can determine the correlation between the data before and after quantization. KL divergence is also called relative entropy, information divergence, and information gain. KL divergence is a measure of the asymmetry of the difference between two probability distributions P and Q. Assuming that the distribution of 32-bit floating-point numbers before quantization is P, and the distribution of 8-bit integers after quantization is Q, then as long as the KL divergence between P and Q is made smaller, it means that the closer the distribution before and after quantization is, the more effective the quantization is. However, the inventors of the present application have found that the quantization effect achieved by the truncation threshold obtained by the traditional KL method is not good, and usually causes a large loss of precision.

[0047] To this end, an embodiment of the present disclosure proposes a new scheme for determining a truncation threshold for symmetric quantization, which can achieve a smaller quantization accuracy loss than traditional techniques (such as the KL method). According to an embodiment of the present disclosure, after obtaining a set of data to be quantized in a winograd convolution process, a set of data to be quantized is quantized using multiple pairs of truncation thresholds to determine multiple sets of quantized data, wherein each pair of truncation thresholds in the multiple pairs of truncation thresholds includes symmetrical truncation positive values ​​and truncation negative values. Then, the difference between the mean of the absolute values ​​of each set of quantized data and the mean of the absolute values ​​of a set of data to be quantized is used as an evaluation index to select a suitable pair of truncation thresholds from the multiple pairs of truncation thresholds. In this way, a more suitable truncation threshold can be found.

[0048] Figure 1 A flow chart of a data processing method according to an embodiment of the present disclosure is shown. Figure 1 As shown, the method includes steps S11 to S14.

[0049] In step S11, a pair of truncation thresholds is determined from multiple pairs of truncation thresholds according to the average of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution processing process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value of the data to be quantized.

[0050] For example, after obtaining a set of data to be quantized in the winograd convolution process, multiple sets of quantized data are determined by using multiple pairs of truncation thresholds to quantize the set of data to be quantized respectively, wherein each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold. The first truncation threshold is greater than the second truncation threshold. Then, the difference between the mean of the absolute values ​​of each set of quantized data and the mean of the absolute values ​​of a set of data to be quantized is used as an evaluation index to select a suitable pair of truncation thresholds from the multiple pairs of truncation thresholds.

[0051] In a possible implementation, step S11 may include:

[0052] In the current round of search, multiple pairs of cutoff thresholds are used to quantize the data to be quantized to obtain multiple groups of quantized data;

[0053] Determine a pair of to-be-selected truncation thresholds from the multiple pairs of truncation thresholds according to the difference between the mean of the absolute values ​​of each group of data and the mean of the absolute values ​​of the data to be quantified;

[0054] When the current round of search meets the condition for continuing the search, a new multiple pairs of truncation thresholds are determined according to the to-be-selected truncation thresholds, and the next round of search is performed according to the new multiple pairs of truncation thresholds until the current round of search does not meet the condition for continuing the search;

[0055] When the current round of search does not satisfy the condition for continuing the search, the to-be-selected truncation threshold is determined to be a pair of truncation thresholds determined from multiple pairs of truncation thresholds.

[0056] In a possible implementation, the continuing search condition may include at least one of the following:

[0057] The number of searches already conducted is less than the total number of searches scheduled;

[0058] The difference between the mean of the absolute values ​​of each group of data in the current search and the mean of the absolute values ​​of the data to be quantified is greater than or equal to the difference threshold.

[0059] In this implementation, a set of data to be quantized in the winograd convolution process is obtained, and the quantized data can be any data in the winograd convolution processing process.

[0060] In this implementation, a pair of truncation thresholds to be selected is determined to include a first truncation threshold and a second truncation threshold to be selected, multiple new pairs of truncation thresholds are determined based on the truncation thresholds to be selected, and the next round of search is performed based on the new multiple pairs of truncation thresholds, including: a new truncation threshold range can be determined based on the first truncation threshold to be selected, and multiple pairs of new truncation thresholds are determined in the truncation threshold range, and then the next round of search is performed.

[0061] For example, Figure 2 FIG. 2 is a schematic diagram showing a method for determining a truncation threshold in a data processing method according to an embodiment of the present disclosure. Figure 2 As shown, assuming that the total number of searches is 2, each vertical line is a first truncation threshold to be determined, and the number of truncation pairs is 10 pairs. In the first round of truncation threshold search, an optimal truncation threshold is determined as the "first truncation threshold to be selected" based on the difference between the mean of the absolute values ​​of each group of data (that is, the data corresponding to the two adjacent first truncation thresholds to be determined) and the mean of the absolute values ​​of the data to be quantified. Then, a second round of truncation threshold search is performed, and a truncation threshold range is determined based on the "first truncation threshold to be selected". For example, the "first truncation threshold to be determined" adjacent to the "first truncation threshold to be selected" in the first round can be directly determined as the new truncation threshold range. Then, a truncation threshold search is performed to determine a new first truncation threshold to be selected. Since the total number of searches is 2, the new first truncation threshold to be selected is determined as the first truncation threshold, and then a pair of truncation thresholds are determined based on the second truncation threshold that has been determined.

[0062] In a possible implementation, the average value of the absolute value of the data to be quantized and the maximum value of the absolute value in the data to be quantized can be determined, wherein the average value of the absolute value is the absolute value of all data in the data to be quantized divided by the number of elements. The minimum mean difference can be initialized, for example, the maximum value in the floating point number is initially set, and the search order i of the cyclic search is initialized (for example, initialized to 0). In some embodiments, the search order i can also be initialized to half of the total number of searches, that is, the search starts from the middle, which can improve the search efficiency. According to an embodiment of the present disclosure, one or more rounds of threshold search processes can be set, and each round of threshold search can have the same or different total number of searches. In some embodiments, the total number of searches per round can be set between 10 and 32. Generally speaking, the more the total number of searches, the longer the search time spent, and the more accurate the truncation threshold value found. However, when the total number of searches reaches a certain value, the search effect may no longer be substantially improved.

[0063] Next, the first round of coarse-grained truncation threshold search process begins. For example, the data to be quantized can be divided into 10 pairs of candidate truncation thresholds, and the quantization process is performed using these 10 pairs of truncation thresholds in turn, and the best pair of truncation thresholds is determined based on the difference in the mean of the absolute values ​​of the data before and after quantization.

[0064] Determine whether the current search order i is less than the predetermined total number of searches, that is, when selecting each pair of truncation thresholds for quantization in turn, determine whether all calculations of the truncation thresholds have been completed. If the current search order i is less than the predetermined total number of searches, then based on the current search order i, determine a pair of truncation thresholds, which are respectively - the maximum value of the absolute value / the predetermined total number of searches*(i+1) and the maximum value of the absolute value / the predetermined total number of searches*(i+1). Use this pair of truncation thresholds to quantize the data to be quantized to obtain the corresponding quantized data Quant_data_i, and calculate the difference abs(Quant_data_mean_i-Data_mean) / Data_mean between the mean value Quant_data_mean_i of the absolute value of the quantized data and the mean value Data_mean of the absolute value of the data to be quantized.

[0065] Determine whether the calculated difference is less than the current minimum difference. If so, set the calculated difference to the current minimum difference, record the truncation threshold when the difference is the smallest, and then increment the current search order i. If it is determined that it is not, directly increment the search order i at the current time, that is, continue to determine the difference when the next pair of truncation thresholds are used. Next, continue to loop through the above steps until the value of the current search order i reaches the predetermined total number of searches, then exit the first truncation threshold search process. After the first round of search, determine the truncation threshold with the smallest difference as the optimal truncation threshold. It can be seen that the process of truncation threshold search is: use multiple pairs of truncation thresholds to quantize the data to be quantized, determine a group of quantized data in multiple groups of quantized data that has the smallest difference in the mean of the absolute value with the data to be quantized, and then select a pair of truncation thresholds corresponding to this group of quantized data from multiple pairs of truncation thresholds.

[0066] Optionally, a second round of fine-grained truncation threshold search process can be performed. The second round of search process can also refer to the aforementioned method, except that the second round of search is performed within a certain range around the optimal truncation threshold of the first round (for example, between the previous truncation threshold and the next truncation threshold of the selected truncation threshold), which is a further refinement of the search results of the first round. For example, in the second round of search, the interval between each pair of truncation thresholds can be (absolute maximum value * 2) / (total number of first round searches * total number of second round searches). After the second round of search, the fine-grained optimal truncation threshold is determined. By means of two rounds of search, a more accurate truncation threshold can be obtained, reducing the precision loss caused by quantization.

[0067] The embodiment of the present disclosure provides a method for iteratively searching for an optimal truncation threshold.

[0068] For example, three pairs of cutoff thresholds are determined. For example, the data to be quantized F can be determined. x The maximum value of the absolute value of all data in absmax, the three pairs of truncation thresholds can be (absmin, absmax / 2), (absmin, absmax*3 / 4), (absmin, absmax). Use these three pairs of truncation thresholds to quantize the data to be quantized and get the quantized data Then calculate separately The corresponding absolute value of the mean F mean , Then according to the formula Select the minimum difference diff_min. Determine whether the minimum difference diff_min is less than a predetermined threshold set in advance. If not, based on the selected pair of truncation thresholds (set the value corresponding to the minimum difference diff_min to the maximum value of the new absolute value), re-determine the three pairs of truncation thresholds, and repeat the above process until the minimum difference diff_min is less than the predetermined threshold, and exit the iterative process of the truncation threshold. In some embodiments, in addition to the iteration stop condition that the minimum difference diff_min is less than the predetermined threshold, other iteration stop conditions may be set, such as the maximum number of iterations, reaching a predetermined minimum interval, and so on. In addition, the disclosed embodiment may also execute the iteration process only once, and then directly use the pair of truncation thresholds corresponding to the minimum difference diff_min as the final truncation threshold.

[0069] In some embodiments, the quantization parameters when quantizing data using each pair of truncation thresholds may be determined by the following equations (1)-(3).

[0070]

[0071]

[0072]

[0073] Where p is the absolute maximum value of the data to be quantized, n is the number of binary bits after quantization, and S and f are quantization parameters.

[0074] According to the embodiment of the present disclosure, by selecting p as absmax / 2, absmax*3 / 4 and absmax respectively, the quantization parameters S1, f1, S2, f2, S3 and f3 can be obtained, thereby obtaining the quantized data Correspondingly, after a pair of truncation thresholds are selected, S and f corresponding to the pair of truncation thresholds are directly taken as quantization data of the data to be quantized.

[0075] By the above method, when the data to be quantized is asymmetric data, the above method can be used to determine a pair of truncation thresholds, and then the data to be quantized is divided into different parts for quantization according to the truncation thresholds, which can improve the accuracy of quantization. It should be noted that the above method for determining a pair of truncation thresholds is only an example of the present disclosure, and those skilled in the art can set the method for determining a pair of truncation thresholds according to actual needs.

[0076] In a possible implementation, the method may include:

[0077] Determine the maximum absolute value of the data in the data to be quantified;

[0078] Determining a plurality of first truncation thresholds based on the maximum absolute value and the truncation logarithm;

[0079] The plurality of pairs of truncation thresholds are obtained according to the plurality of first truncation thresholds and the second truncation thresholds.

[0080] According to an embodiment of the present disclosure, multiple pairs of truncation thresholds may be selected to quantize the data to be quantized respectively. In some embodiments, some truncation thresholds may be selected at fixed intervals.

[0081] For example, a cutoff threshold is selected at every predetermined distance according to the maximum absolute value of the absolute values ​​of all data in the data to be quantized. In some embodiments, the cutoff thresholds at only a few specific positions may be selected, for example, only a few predetermined ratios of the maximum absolute value may be selected.

[0082] In some embodiments, one or more corresponding quantization parameters (e.g., point position parameters, scaling factors, offsets, etc.) may be calculated based on each pair of truncation thresholds, and then the calculated quantization parameters may be used to quantize the data to be quantized. Alternatively, the data to be quantized may be directly quantized by various formulas or models based on the truncation thresholds without separately calculating the values ​​of the various quantization parameters.

[0083] Based on the difference between the mean of the absolute values ​​of each group of quantized data in the multiple groups of quantized data and the mean of the absolute values ​​of a group of data to be quantized, a pair of truncation thresholds is selected from multiple pairs of truncation thresholds to quantize a group of data to be quantized. Since the mean difference of the absolute values ​​of the data before and after quantization can reflect the precision loss before and after quantization, the smaller the difference between the absolute values ​​and the mean values, the smaller the precision loss of the quantization operation. Therefore, the embodiment of the present disclosure uses the difference between the mean of the absolute values ​​of the data before and after quantization as an indicator for selecting the best truncation threshold, which can achieve a smaller precision loss than the traditional KL method.

[0084] In some embodiments, the difference between the mean of the absolute values ​​of the quantized data and the mean of the absolute values ​​of the data to be quantized may be the difference between the means of the two absolute values. Alternatively, the difference between the mean of the absolute values ​​of the quantized data and the mean of the absolute values ​​of the data to be quantized may also be: the difference between the means of the two absolute values ​​divided by the mean of the absolute values ​​of the data to be quantized, and then the absolute value is taken.

[0085] In a possible implementation, determining a pair of candidate truncation thresholds from the multiple pairs of truncation thresholds according to a difference between a mean of the absolute values ​​of each group of data and a mean of the absolute values ​​of the data to be quantized may include:

[0086] Selecting a group of first quantized data from the multiple groups of quantized data, wherein a difference between a mean of absolute values ​​of the group of first quantized data and a mean of absolute values ​​of the group of data to be quantized is smaller than a difference between a mean of absolute values ​​of multiple groups of second quantized data and a mean of absolute values ​​of the group of data to be quantized, wherein the multiple groups of second quantized data are other groups of quantized data from the multiple groups of quantized data except the group of first quantized data;

[0087] A pair of truncation thresholds corresponding to the set of first quantized data is selected from the plurality of pairs of truncation thresholds.

[0088] Determine the mean of the absolute values ​​of each group of quantized data, and determine the difference between the mean of the absolute values ​​of each group of quantized data and the mean of the absolute values ​​of a group of data to be quantized, determine the group of quantized data with the smallest difference as the first quantized data, and determine the other groups of quantized data except the first quantized data as the second quantized data, that is, the difference between the mean of the absolute values ​​of the first quantized data and the mean of the absolute values ​​of a group of data to be quantized is less than the difference between the mean of the absolute values ​​of the second quantized data and the mean of the absolute values ​​of a group of data to be quantized. Determine a pair of truncation thresholds used to quantize the data to be quantized to obtain the first quantized data as a pair of truncation thresholds used to quantize the data to be quantized.

[0089] For example, after determining a pair of |T1| to |T2|, data outside the range of |T|1 to |T2| will be set to |T1| or |T2|, where |T1| is the determined first truncation positive value, and |T2| is the determined second truncation negative value. For example, data within the truncation range corresponding to a pair of truncation thresholds are quantized according to the quantization parameter, and the value to be quantized that is outside the truncation range and less than |T2| is treated as the value |T2| for quantization, and the value to be quantized that is outside the truncation range and greater than |T1| is treated as the value |T1| for quantization. In this way, by using the truncation threshold to narrow the value range of the data to be quantized, the accuracy of the quantized data can be improved.

[0090] In step S12, the data to be quantized is quantized according to the determined pair of truncation thresholds to obtain quantized data.

[0091] For example, after selecting the best pair of truncation thresholds, the selected pair of truncation thresholds can be used to quantize a set of data to be quantized to obtain quantized first data, including: truncating the values ​​in the set of data to be quantized that are greater than the first truncation threshold to the first truncation threshold, and truncating the values ​​in the set of data to be quantized that are less than the second truncation threshold to the second truncation threshold.

[0092] In step S13, the winograd convolution process is continued to be performed according to the quantized data to obtain a quantized winograd convolution result.

[0093] In step S14, a dequantization process is performed on the quantized winograd convolution result to obtain a winograd convolution result.

[0094] The data to be quantized, the data to be calculated, and the like mentioned in the embodiments of the present disclosure may be data that may appear in the actual data processing process, and may be data corresponding to image data, video data, audio data, text data, and the like. For example, the method provided by the present disclosure is used for applications in scenes such as image processing, video processing, and audio processing. Taking the data to be calculated as image data as an example, the data to be calculated may be expressed in the form of NHWC (batch, height, width, channels), where N represents the number of images, HW represents the number of pixels in the height and width directions, respectively, and C may represent the number of channels, for example, C may represent RGB (Red, Ggreen, Blue) three channels, and the above expression is only an example of the present disclosure, and the present disclosure is not limited thereto. It should be noted that the above method may be applied to any data that can be quantized and processed by winograd convolution operations, and those skilled in the art may set the type of data and its corresponding application scenario according to actual needs, and the present disclosure does not limit this.

[0095] In a possible implementation, the winograd convolution processing includes:

[0096] Decomposing the Winograd forward transformation of the data to be operated into a summation operation, and calculating to obtain the Winograd forward transformation result of each data in the data to be operated;

[0097] Performing a bitwise multiplication operation between the winograd forward transformation results of the corresponding data in the data to be operated to obtain a bitwise multiplication result;

[0098] Decompose the inverse winograd transform of the bitwise multiplication result into a summation operation to obtain the winograd convolution result.

[0099] The data to be quantized may be any one of the data to be calculated, a Winograd forward transformation result of the data to be calculated, and a bitwise multiplication result.

[0100] In a possible implementation, the data to be calculated includes at least one of input neurons, weights, and gradients.

[0101] For example, the data to be quantized can be quantized to speed up the processing speed of the winograd convolution. In some embodiments, the data to be quantized can be a 32-bit floating point number. Alternatively, the data to be quantized can also be a floating point number of other digits, or other data types.

[0102] In a possible implementation manner, quantizing the data to be quantized according to the determined pair of truncation thresholds to obtain quantized data includes any of the following operations:

[0103] Before decomposing the Winograd forward transformation of the data to be operated into a summation operation, the data to be operated is used as data to be quantized for quantization;

[0104] Before performing the bitwise multiplication operation, the winograd forward transformation result of each data in the data to be operated is used as the data to be quantized for quantization;

[0105] Before performing the inverse winograd transform and decomposing it into a summation operation, the bitwise multiplication result is used as the data to be quantized and quantized.

[0106] Exemplarily, the data to be quantized is the data to be calculated, and the winograd convolution process can be:

[0107] A pair of determined truncation thresholds are used to quantize the data to be operated to obtain the quantized data to be operated; the Winograd forward transform of the quantized data to be operated is decomposed into a sum operation, and the Winograd forward transform result of the quantized data to be operated is obtained by calculation; a bitwise multiplication operation is performed on the Winograd forward transform result of the quantized data to be operated to obtain a bitwise multiplication result; the Winograd inverse transform of the bitwise multiplication result is decomposed into a sum operation to obtain the quantized Winograd convolution result, and the quantized Winograd convolution result is dequantized to obtain a Winograd convolution result.

[0108] Exemplarily, the data to be quantized is the winograd forward transformation result of the data to be calculated, and the winograd convolution process can be:

[0109] The Winograd forward transform of the data to be operated is decomposed into a summation operation, and the Winograd forward transform result of the data to be operated is calculated; the Winograd forward transform result of the data to be operated is quantized by using a determined pair of truncation thresholds to obtain the quantized Winograd forward transform result of the data to be operated; a bitwise multiplication operation is performed on the quantized Winograd forward transform result of the data to be operated to obtain the bitwise multiplication result; the Winograd inverse transform of the bitwise multiplication result is decomposed into a summation operation to obtain the quantized Winograd convolution result, and the quantized Winograd convolution result is dequantized to obtain the Winograd convolution result.

[0110] Exemplarily, if the data to be quantized is the result of bitwise multiplication, the winograd convolution process can be:

[0111] The Winograd forward transform of the data to be operated is decomposed into a summation operation, and the Winograd forward transform result of the data to be operated is calculated; the positional multiplication operation of the Winograd forward transform result of the data to be operated is performed to obtain the positional multiplication result; the positional multiplication result is quantized using a determined pair of truncation thresholds to obtain a quantized positional multiplication result; the Winograd inverse transform of the quantized positional multiplication result is decomposed into a summation operation to obtain a quantized Winograd convolution result. The quantized Winograd convolution result is dequantized to obtain a Winograd convolution result.

[0112] In a possible implementation, decomposing the Winograd forward transformation of the data to be operated into a summation operation, and calculating to obtain the Winograd forward transformation result of each data in the data to be operated, includes:

[0113] Each data in the data to be calculated is decomposed into a plurality of first sub-tensors, and a Winograd positive transformation is performed on the plurality of first sub-tensors of each data in the data to be calculated, and the sums are obtained to obtain a Winograd positive transformation result of each data in the data to be calculated.

[0114] Among them, the number of multiple first sub-tensors split from each data is the same as the number of non-zero elements in the corresponding data, and one element in each first sub-tensor is the same as the element at the corresponding position in the corresponding data, and the other elements are all 0.

[0115] For example, suppose the input neuron is represented as:

[0116] The input neuron is a 4×4 matrix including 16 elements, so the data to be calculated can be decomposed into 16 first sub-tensors.

[0117] Then, according to the disassembly method disclosed in this disclosure, the 16 first sub-tensors are:

[0118]

[0119] In each first sub-tensor, one element is the same as the element at the corresponding position in the data to be operated, and the other elements are all 0, which means: 00 For example, the element in the first row and first column is the same as the element in the first row and first column of the input neuron, and the other elements are all 0. The other first sub-tensors also have the same properties.

[0120] It should be noted that the above decomposition methods are merely some examples of the present disclosure and do not limit the present disclosure in any way. For example, if the data to be calculated contains elements with a value of 0, the number of first sub-tensors obtained by decomposition may be less than the number of elements of the data to be calculated. For example, the number of multiple first sub-tensors is the same as the number of non-zero elements of the data to be calculated.

[0121] In a possible implementation, performing a Winograd positive transformation on a plurality of first sub-tensors of each data in the data to be operated and summing them to obtain a Winograd positive transformation result of each data in the data to be operated may include:

[0122] Get the winograd forward transform result of the first-element sub-tensor corresponding to the first sub-tensor; wherein the first-element sub-tensor corresponding to the first sub-tensor is: the value of the element at the first position in the first-element sub-tensor is 1, wherein the position of the first position in the first-element sub-tensor is the same as the position of the non-zero element in the first sub-tensor;

[0123] The non-zero element value in the first sub-tensor is used as a coefficient to multiply the corresponding Winograd positive transformation result of the first element sub-tensor to obtain the Winograd positive transformation result of the first sub-tensor;

[0124] The Winograd forward transformation results of the multiple first sub-tensors are added together to obtain the Winograd forward transformation result of the data to be calculated.

[0125] Still with the first subtensor d 00 For example, d 00 The corresponding first-element sub-tensor can be That is to say, the first-element sub-tensor extracts the non-zero element values ​​in the first sub-tensor, and the values ​​of the non-zero elements can be used as coefficients of the first-element sub-tensor.

[0126] Among them, the winograd forward transformation result of the first element sub-tensor corresponding to the first sub-tensor can be obtained in advance through the following process: for each first sub-tensor, the first element sub-tensor corresponding to the first sub-tensor is multiplied on the left by the positive transformation left multiplication matrix and on the right by the positive transformation right multiplication matrix to obtain the winograd forward transformation result of the first element sub-tensor.

[0127] For matrices of different sizes, the form of the corresponding first-element sub-tensor is determined, and the corresponding positive transformation left-multiplication matrix and positive transformation right-multiplication matrix are also determined.

[0128] Therefore, the Winograd forward transformation result of the first element tensor can be calculated in advance, and the specific process is as described above. 00For example, the corresponding winograd positive transformation result of the first element tensor is:

[0129]

[0130] For example, with d 01 For example, the corresponding winograd positive transformation result of the first element tensor is:

[0131]

[0132] Since the element values ​​of the positive transformation left multiplication matrix and the positive transformation right multiplication matrix are both 0 and ±1, the element values ​​of the first element sub-tensor are 0 or 1, and the elements in the winograd positive transformation result of the first element sub-tensor are also 0 and ±1. Therefore, the matrix multiplication operation can be disassembled into an addition operation.

[0133] The process of calculating the Winograd forward transform result of the first-element sub-tensor involves a large number of multiplication operations. Through the method disclosed in the present invention, the pre-calculated Winograd forward transform results of the first-element sub-tensors of various sizes can be saved in the computing device. In this way, in the actual computing process, they can be directly obtained without repeated computing, thereby shortening the computing time and saving computing resources.

[0134] After obtaining the winograd positive transformation result of the first element sub-tensor corresponding to the first sub-tensor, the winograd positive transformation result of the first element sub-tensor can be obtained by multiplying the non-zero element value in the first sub-tensor by the winograd positive transformation result of the corresponding first element sub-tensor. 00 For example, the corresponding winograd positive transformation result is:

[0135] For example, with d 01 For example, d 01 The winograd positive transformation result is

[0136] The winograd forward transformation results of all first sub-tensors are calculated through the above process, and the winograd forward transformation results of multiple first sub-tensors are added together to obtain the winograd forward transformation result of the data to be calculated.

[0137]

[0138]

[0139] Since the elements in the winograd transformation result of the first-element sub-tensor obtained by the transformation are also 0 and ±1, the right sides of the above equations (1) and (2) only involve summation operations.

[0140] According to the above-mentioned embodiments of the present disclosure, it can be known that by decomposing the data to be calculated to obtain multiple first sub-tensors, the winograd forward transform result of the data to be calculated can be obtained by performing a sum operation based on the pre-calculated winograd forward transform result of the first element sub-tensor corresponding to the first sub-tensor and the non-zero element value of the first sub-tensor to obtain the winograd forward transform result of the data to be calculated.

[0141] After the above-mentioned decomposition into a summation operation is used to obtain the Winograd forward transformation result of the input neuron, the Winograd forward transformation result of the weight can be calculated. The calculation method of the Winograd forward transformation result of the weight can be a traditional matrix multiplication calculation, or it can refer to the above-mentioned decomposition into a summation operation to calculate the Winograd forward transformation result.

[0142] After obtaining the winograd forward transformation result of the data to be operated (input neurons, weights, gradients), the bitwise multiplication operation of the winograd forward transformation result of the data to be operated can be continued to be performed to obtain the bitwise multiplication result. Among them, the bitwise multiplication can refer to the data obtained by multiplying the data at the corresponding positions of the two tensors as the value of the corresponding position in the bitwise multiplication result.

[0143] Assume that the winograd positive transformation result of the input neuron is B T d 4×4 B can be expressed as:

[0144] Winograd forward transformation result of weights It can be expressed as:

[0145] Then the result of bitwise multiplication can be:

[0146]

[0147] The winograd convolution result of the data to be calculated can be expressed as S 4×4 =A T (G 4×4 ⊙D 4×4 )A, the slave function processing unit of the present disclosure can be A T (G 4×4 ⊙D 4×4 )A is decomposed into a summation operation, and the winograd convolution result of the data to be operated is obtained by calculation, thereby further saving calculation time and reducing energy consumption.

[0148] In a possible implementation, decomposing the inverse winograd transform of the bitwise multiplication result into a summation operation to obtain the winograd convolution result may include:

[0149] Decomposing the bitwise multiplication result into a plurality of second sub-tensors, performing an inverse Winograd transformation on the plurality of second sub-tensors and summing them, to obtain a Winograd convolution result of the data to be operated;

[0150] Among them, the number of the multiple second sub-tensors is the same as the number of non-zero elements in the bitwise multiplication result, and each of the multiple second sub-tensors has an element that is the same as the element at the corresponding position in the bitwise multiplication result, and the other elements are all 0.

[0151] Assume that the result of bitwise multiplication is:

[0152]

[0153] The bitwise multiplication result is decomposed into multiple second sub-tensors. For example, it can be decomposed into 16 second sub-tensors. The 16 second sub-tensors are:

[0154]

[0155] After the disassembly, the multiple second sub-tensors can be subjected to inverse winograd transformation and summed to obtain the winograd convolution result of the data to be calculated.

[0156] In a possible implementation, performing inverse winograd transformation on the multiple second sub-tensors and summing them to obtain the winograd convolution result of the data to be operated may include the following process:

[0157] Get the inverse winograd transform result of the second element sub-tensor corresponding to the second sub-tensor; wherein the second element sub-tensor corresponding to the second sub-tensor is: the value of the element at the second position in the second element sub-tensor is 1, wherein the position of the second position in the second element sub-tensor is the same as the position of the non-zero element in the second sub-tensor;

[0158] The non-zero element value in the second sub-tensor is used as a coefficient to multiply the inverse winograd transformation result of the corresponding second element sub-tensor to obtain the inverse winograd transformation result of the second sub-tensor;

[0159] The winograd inverse transformation results of the multiple second sub-tensors are added together to obtain the winograd convolution result of the data to be operated.

[0160] The method for determining the second element sub-tensor corresponding to the second sub-tensor is the same as the method for determining the first element sub-tensor in the above text, and will not be repeated. Among them, the winograd inverse transformation result of the second element sub-tensor is obtained in advance through the following process: for each second sub-tensor, the second element sub-tensor corresponding to the second sub-tensor is multiplied on the left by the inverse transformation left multiplication matrix and on the right by the inverse transformation right multiplication matrix to obtain the winograd inverse transformation result of the second element sub-tensor.

[0161] For matrices of different sizes, the form of the corresponding second-element tensor is determined, and the corresponding inverse transformation left-multiplication matrix and inverse transformation right-multiplication matrix are also determined. Therefore, the winograd inverse transformation result of the second-element tensor can be calculated in advance, and the specific process is as described above. For the examples listed above in this article, the inverse transformation left-multiplication matrix is ​​a 2×4 matrix, for example, it can be:

[0162] The inverse transformation right multiplication matrix is ​​a 4×2 matrix, for example, it can be:

[0163] The dimension of the inverse transformation matrix can be determined according to the dimension of the input neuron and the dimension of the weight and the convolution step size. The above is merely an example and does not limit the present disclosure in any way.

[0164] The inverse transformation matrix is ​​given by Therefore, the matrix multiplication operation of the inverse transformation can be decomposed into addition and shift operations. Multiplying the inverse transformation matrix by the second element tensor can obtain the inverse winograd transformation result of the second element tensor. The element values ​​in the inverse winograd transformation result of the second element tensor are given by The fraction can be calculated by simple shift operations, which can still save calculation time compared to multiplication operations.

[0165] The specific process of "using the non-zero element values ​​in the second sub-tensor as coefficients to multiply the corresponding inverse winograd transform result of the second sub-tensor to obtain the inverse winograd transform result of the second sub-tensor; adding the inverse winograd transform results of multiple second sub-tensors to obtain the winograd convolution result of the data to be calculated" can refer to the above, except that the inverse winograd transform result of the second sub-tensor is not completely composed of 0 and ±1, but the fraction can be calculated by a simple shift operation. Compared with the multiplication operation, the present invention can still achieve the effect of saving calculation time and reducing energy consumption after disassembling the ordinary inverse transformation process.

[0166] According to the above-mentioned embodiments of the present disclosure, it can be known that by disassembling the bitwise multiplication result to obtain multiple second sub-tensors, the winograd inverse transform result of the second element sub-tensor corresponding to the pre-calculated second sub-tensor and the non-zero element value of the second sub-tensor can be summed up to obtain the winograd convolution result of the data to be operated.

[0167] According to the data processing method disclosed in the present invention, a pair of truncation thresholds is determined from the multiple pairs of truncation thresholds according to the mean of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using the multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution processing process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value in the data to be quantized; the data to be quantized is quantized according to the determined pair of truncation thresholds to obtain quantized data; winograd convolution processing is continued according to the quantized data to obtain a quantized winograd convolution result; dequantization processing is performed on the quantized winograd convolution result to obtain a winograd convolution result, which can improve the quantization accuracy while saving the operation time of winograd convolution and reducing energy consumption.

[0168] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.

[0169] It should be further explained that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0170] Figure 3 FIG. 1 is a block diagram of a data processing device according to an embodiment of the present disclosure. Figure 3As shown, the device includes: a first determination module 41, a first quantization module 42, a convolution processing module 43 and a dequantization processing module 44.

[0171] A first determination module 41 determines a pair of truncation thresholds from multiple pairs of truncation thresholds according to the average of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value of the data to be quantized;

[0172] A first quantization module 42 performs quantization processing on the data to be quantized according to the determined pair of cutoff thresholds to obtain quantized data;

[0173] A convolution processing module 43 continues to perform winograd convolution processing according to the quantized data to obtain a quantized winograd convolution result;

[0174] The dequantization processing module 44 performs dequantization processing on the quantized winograd convolution result to obtain a winograd convolution result.

[0175] According to the data processing device disclosed in the present invention, the quantization accuracy can be improved while saving the operation time of winograd convolution and reducing energy consumption.

[0176] In a possible implementation manner, the first determining module is further configured to:

[0177] In the current round of search, multiple pairs of cutoff thresholds are used to quantize the data to be quantized to obtain multiple groups of quantized data;

[0178] Determine a pair of to-be-selected truncation thresholds from the multiple pairs of truncation thresholds according to the difference between the mean of the absolute values ​​of each group of data and the mean of the absolute values ​​of the data to be quantified;

[0179] When the current round of search meets the condition for continuing the search, a new multiple pairs of truncation thresholds are determined according to the to-be-selected truncation thresholds, and the next round of search is performed according to the new multiple pairs of truncation thresholds until the current round of search does not meet the condition for continuing the search;

[0180] When the current round of search does not satisfy the condition for continuing the search, the to-be-selected truncation threshold is determined to be a pair of truncation thresholds determined from multiple pairs of truncation thresholds.

[0181] In a possible implementation, the continuing search condition includes at least one of the following:

[0182] The number of searches already conducted is less than the total number of searches scheduled;

[0183] The difference between the mean of the absolute values ​​of each group of data in the current search and the mean of the absolute values ​​of the data to be quantified is greater than or equal to the difference threshold.

[0184] In a possible implementation manner, the device further includes:

[0185] A second determination module determines the maximum absolute value of the data in the data to be quantified;

[0186] A third determination module determines a plurality of first truncation thresholds based on the maximum absolute value and the truncation logarithm;

[0187] The fourth determining module obtains the plurality of pairs of truncation thresholds according to the plurality of first truncation thresholds and the second truncation thresholds.

[0188] In a possible implementation, the winograd convolution processing includes:

[0189] Decomposing the Winograd forward transformation of the data to be operated into a summation operation, and calculating to obtain the Winograd forward transformation result of each data in the data to be operated;

[0190] Performing a bitwise multiplication operation between the winograd forward transformation results of the corresponding data in the data to be operated to obtain a bitwise multiplication result;

[0191] Decompose the inverse winograd transform of the bitwise multiplication result into a summation operation to obtain the winograd convolution result.

[0192] The data to be quantized is any one of the data to be calculated, the winograd forward transformation result of the data to be calculated, and the bitwise multiplication result.

[0193] In a possible implementation manner, the first quantization module is further configured to perform any of the following operations:

[0194] Before decomposing the Winograd forward transformation of the data to be operated into a summation operation, the data to be operated is used as data to be quantized for quantization;

[0195] Before performing the bitwise multiplication operation, the winograd forward transformation result of each data in the data to be operated is used as the data to be quantized for quantization;

[0196] Before performing the inverse winograd transform and decomposing it into a summation operation, the bitwise multiplication result is used as the data to be quantized and quantized.

[0197] In a possible implementation, decomposing the Winograd forward transformation of the data to be operated into a summation operation, and calculating to obtain the Winograd forward transformation result of each data in the data to be operated, includes:

[0198] Each data in the data to be calculated is decomposed into a plurality of first sub-tensors, and a Winograd positive transformation is performed on the plurality of first sub-tensors of each data in the data to be calculated, and the sums are obtained to obtain a Winograd positive transformation result of each data in the data to be calculated.

[0199] Among them, the number of multiple first sub-tensors split from each data is the same as the number of non-zero elements in the corresponding data, and one element in each first sub-tensor is the same as the element at the corresponding position in the corresponding data, and the other elements are all 0.

[0200] In a possible implementation, decomposing the inverse winograd transform of the bitwise multiplication result into a summation operation to obtain the winograd convolution result includes:

[0201] Decomposing the bitwise multiplication result into a plurality of second sub-tensors, performing an inverse Winograd transformation on the plurality of second sub-tensors and summing them, to obtain a Winograd convolution result of the data to be operated;

[0202] Among them, the number of the multiple second sub-tensors is the same as the number of non-zero elements in the bitwise multiplication result, and each of the multiple second sub-tensors has an element that is the same as the element at the corresponding position in the bitwise multiplication result, and the other elements are all 0.

[0203] In a possible implementation, the data to be calculated includes at least one of input neurons, weights, and gradients.

[0204] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present disclosure can also be implemented in other ways. For example, the division of units / modules described in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0205] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present disclosure may be integrated into one unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0206] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as resistive random access memory RRAM (Resistive Random Access Memory), dynamic random access memory DRAM (Dynamic Random Access Memory), static random access memory SRAM (Static Random-Access Memory), enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), high-bandwidth memory HBM (High-Bandwidth Memory), hybrid memory cube HMC (Hybrid Memory Cube), etc.

[0207] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0208] The data processing method according to the embodiment of the present disclosure can be applied to a processor, which can be a general-purpose processor, such as a CPU (Central Processing Unit), or an artificial intelligence processor (IPU) for performing artificial intelligence operations. Artificial intelligence operations may include machine learning operations, brain-like operations, etc. Among them, machine learning operations include neural network operations, k-means operations, support vector machine operations, etc. The artificial intelligence processor may, for example, include one or a combination of GPU (Graphics Processing Unit), NPU (Neural-Network Processing Unit), DSP (Digital Signal Process), and Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) chips. The present disclosure does not limit the specific type of processor.

[0209] In a possible implementation, the processor mentioned in the present disclosure may include multiple processing units, each of which may independently run various assigned tasks, such as convolution operation tasks, pooling tasks, or fully connected tasks, etc. The present disclosure does not limit the processing units and the tasks run by the processing units.

[0210] The processor includes multiple processing units and storage units. The multiple processing units are used to execute instruction sequences. The storage units are used to store data and may include random access memory (RAM) and register files. The multiple processing units in the processor can share part of the storage space, such as part of the RAM storage space and register files, or have their own storage space at the same time.

[0211] In a possible implementation, an artificial intelligence chip is also disclosed, which includes the above-mentioned data processing device.

[0212] In a possible implementation, a board is also disclosed, which includes a storage device, an interface device, a control device and the above-mentioned artificial intelligence chip; wherein the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively; the storage device is used to store data; the interface device is used to realize data transmission between the artificial intelligence chip and an external device; the control device is used to monitor the status of the artificial intelligence chip.

[0213] Figure 4 A structural block diagram of a board according to an embodiment of the present disclosure is shown. Figure 4In addition to the chip 389, the board may also include other supporting components, including but not limited to: a storage device 390, an interface device 391 and a control device 392;

[0214] The storage device 390 is connected to the artificial intelligence chip via a bus for storing data. The storage device may include multiple groups of storage units 393. Each group of storage units is connected to the artificial intelligence chip via a bus. It is understood that each group of storage units may be DDR SDRAM (English: Double Data Rate SDRAM, double rate synchronous dynamic random access memory).

[0215] DDR can double the speed of SDRAM without increasing the clock frequency. DDR allows data to be read out on the rising and falling edges of the clock pulse. The speed of DDR is twice that of standard SDRAM. In one embodiment, the storage device may include 4 groups of storage units. Each group of storage units may include multiple DDR4 particles (chips). In one embodiment, the artificial intelligence chip may include 4 72-bit DDR4 controllers, 64 bits of the above 72-bit DDR4 controllers are used to transmit data, and 8 bits are used for ECC verification. It can be understood that when DDR4-3200 particles are used in each group of storage units, the theoretical bandwidth of data transmission can reach 25600MB / s.

[0216] In one embodiment, each group of the storage units includes a plurality of double rate synchronous dynamic random access memories arranged in parallel. DDR can transmit data twice in one clock cycle. A controller for controlling DDR is arranged in the chip to control the data transmission and data storage of each of the storage units.

[0217] The interface device is electrically connected to the artificial intelligence chip. The interface device is used to realize data transmission between the artificial intelligence chip and an external device (such as a server or a computer). For example, in one embodiment, the interface device may be a standard PCIE interface. For example, the data to be processed is transmitted to the chip by the server through a standard PCIE interface to realize data transfer. Preferably, when the PCIE 3.0X 16 interface is used for transmission, the theoretical bandwidth can reach 16000MB / s. In another embodiment, the interface device may also be other interfaces. The present disclosure does not limit the specific forms of expression of the above-mentioned other interfaces, and the interface unit can realize the switching function. In addition, the calculation results of the artificial intelligence chip are still transmitted back to the external device (such as a server) by the interface device.

[0218] The control device is electrically connected to the artificial intelligence chip. The control device is used to monitor the state of the artificial intelligence chip. Specifically, the artificial intelligence chip and the control device can be electrically connected through an SPI interface. The control device may include a single-chip microcomputer (Micro Controller Unit, MCU). For example, the artificial intelligence chip may include multiple processing chips, multiple processing cores or multiple processing circuits, which can drive multiple loads. Therefore, the artificial intelligence chip can be in different working states such as multi-load and light load. The control device can realize the regulation of the working states of multiple processing chips, multiple processing and / or multiple processing circuits in the artificial intelligence chip.

[0219] In a possible implementation, an electronic device is disclosed, which includes the above-mentioned artificial intelligence chip. The electronic device includes a data processing device, a robot, a computer, a printer, a scanner, a tablet computer, a smart terminal, a mobile phone, a driving recorder, a navigator, a sensor, a camera, a server, a cloud server, a camera, a video camera, a projector, a watch, a headset, a mobile storage, a wearable device, a means of transportation, a household appliance, and / or a medical device. The means of transportation include an airplane, a ship and / or a vehicle; the household appliance includes a television, an air conditioner, a microwave oven, a refrigerator, an electric rice cooker, a humidifier, a washing machine, an electric lamp, a gas stove, and a range hood; the medical device includes an MRI, an ultrasound machine and / or an electrocardiograph.

[0220] The embodiment of the present disclosure also provides a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above method is implemented. The computer-readable storage medium may be a non-volatile computer-readable storage medium.

[0221] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to call the instructions stored in the memory to execute the above method.

[0222] Figure 5 A block diagram of an electronic device 800 according to an embodiment of the present disclosure is shown. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.

[0223] Reference Figure 5 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0224] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0225] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0226] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0227] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0228] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0229] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0230] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0231] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0232] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0233] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 804 including computer program instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above method.

[0234] Figure 6 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server. Figure 6 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0235] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.

[0236] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.

[0237] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0238] The foregoing content can be better understood in accordance with the following terms:

[0239] Clause A1. A method of data processing, the method comprising:

[0240] Determine a pair of truncation thresholds from the multiple pairs of truncation thresholds according to the average of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using the multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value in the data to be quantized;

[0241] Quantizing the data to be quantized according to the determined pair of cutoff thresholds to obtain quantized data;

[0242] Continue to perform winograd convolution processing according to the quantized data to obtain a quantized winograd convolution result;

[0243] Dequantization is performed on the quantized winograd convolution result to obtain a winograd convolution result.

[0244] Clause A2. A method according to clause A1, wherein a pair of truncation thresholds is determined from the plurality of pairs of truncation thresholds based on the average of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using the plurality of pairs of truncation thresholds, comprising:

[0245] In the current round of search, multiple pairs of cutoff thresholds are used to quantize the data to be quantized to obtain multiple groups of quantized data;

[0246] Determine a pair of to-be-selected truncation thresholds from the multiple pairs of truncation thresholds according to the difference between the mean of the absolute values ​​of each group of data and the mean of the absolute values ​​of the data to be quantified;

[0247] When the current round of search meets the condition for continuing the search, a new multiple pairs of truncation thresholds are determined according to the to-be-selected truncation thresholds, and the next round of search is performed according to the new multiple pairs of truncation thresholds until the current round of search does not meet the condition for continuing the search;

[0248] When the current round of search does not satisfy the condition for continuing the search, the to-be-selected truncation threshold is determined to be a pair of truncation thresholds determined from multiple pairs of truncation thresholds.

[0249] Clause A3. The method according to clause A2, wherein the continuing search condition includes at least one of the following:

[0250] The number of searches already conducted is less than the total number of searches scheduled;

[0251] The difference between the mean of the absolute values ​​of each group of data in the current search and the mean of the absolute values ​​of the data to be quantified is greater than or equal to the difference threshold.

[0252] Clause A4. The method according to clause A1 or 2, further comprising:

[0253] Determine the maximum absolute value of the data in the data to be quantified;

[0254] Determining a plurality of first truncation thresholds based on the maximum absolute value and the truncation logarithm;

[0255] The plurality of pairs of truncation thresholds are obtained according to the plurality of first truncation thresholds and the second truncation thresholds.

[0256] Clause A5. The method according to clause A1, wherein the winograd convolution processing process comprises:

[0257] Decomposing the Winograd forward transformation of the data to be operated into a summation operation, and calculating to obtain the Winograd forward transformation result of each data in the data to be operated;

[0258] Performing a bitwise multiplication operation between the winograd forward transformation results of the corresponding data in the data to be operated to obtain a bitwise multiplication result;

[0259] Decompose the inverse winograd transform of the bitwise multiplication result into a summation operation to obtain the winograd convolution result.

[0260] The data to be quantized is any one of the data to be calculated, the winograd forward transformation result of the data to be calculated, and the bitwise multiplication result.

[0261] Clause A6. The method according to clause A5, wherein the data to be quantized is quantized according to the determined pair of cutoff thresholds to obtain quantized data, including any of the following operations:

[0262] Before decomposing the Winograd forward transformation of the data to be operated into a summation operation, the data to be operated is used as data to be quantized for quantization;

[0263] Before performing the bitwise multiplication operation, the winograd forward transformation result of each data in the data to be operated is used as the data to be quantized for quantization;

[0264] Before performing the inverse winograd transform and decomposing it into a summation operation, the bitwise multiplication result is used as the data to be quantized and quantized.

[0265] Clause A7. The method according to clause A5, wherein the Winograd transformation of the data to be operated is decomposed into a summation operation, and the Winograd transformation result of each data in the data to be operated is calculated, comprising:

[0266] Each data in the data to be calculated is decomposed into a plurality of first sub-tensors, and a Winograd positive transformation is performed on the plurality of first sub-tensors of each data in the data to be calculated, and the sums are obtained to obtain a Winograd positive transformation result of each data in the data to be calculated.

[0267] Among them, the number of multiple first sub-tensors split from each data is the same as the number of non-zero elements in the corresponding data, and one element in each first sub-tensor is the same as the element at the corresponding position in the corresponding data, and the other elements are all 0.

[0268] Clause A8. The method according to clause A5, wherein the inverse winograd transform of the bitwise multiplication result is decomposed into a summation operation to obtain the winograd convolution result, comprising:

[0269] Decomposing the bitwise multiplication result into a plurality of second sub-tensors, performing an inverse Winograd transformation on the plurality of second sub-tensors and summing them, to obtain a Winograd convolution result of the data to be operated;

[0270] Among them, the number of the multiple second sub-tensors is the same as the number of non-zero elements in the bitwise multiplication result, and each of the multiple second sub-tensors has an element that is the same as the element at the corresponding position in the bitwise multiplication result, and the other elements are all 0.

[0271] Item A9. According to the method described in Item A5, the data to be calculated includes at least one of input neurons, weights and gradients.

[0272] Clause A10. A data processing apparatus, the apparatus comprising:

[0273] A first determination module determines a pair of truncation thresholds from multiple pairs of truncation thresholds according to the average of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value of the data to be quantized;

[0274] A first quantization module performs quantization processing on the data to be quantized according to the determined pair of truncation thresholds to obtain quantized data;

[0275] A convolution processing module, further performing winograd convolution processing according to the quantized data to obtain a quantized winograd convolution result;

[0276] The dequantization processing module performs dequantization processing on the quantized winograd convolution result to obtain a winograd convolution result.

[0277] Clause A11. The apparatus of clause A10, wherein the first determining module is further configured to:

[0278] In the current round of search, multiple pairs of cutoff thresholds are used to quantize the data to be quantized to obtain multiple groups of quantized data;

[0279] Determine a pair of to-be-selected truncation thresholds from the multiple pairs of truncation thresholds according to the difference between the mean of the absolute values ​​of each group of data and the mean of the absolute values ​​of the data to be quantified;

[0280] When the current round of search meets the condition for continuing the search, a new multiple pairs of truncation thresholds are determined according to the to-be-selected truncation thresholds, and the next round of search is performed according to the new multiple pairs of truncation thresholds until the current round of search does not meet the condition for continuing the search;

[0281] When the current round of search does not satisfy the condition for continuing the search, the to-be-selected truncation threshold is determined to be a pair of truncation thresholds determined from multiple pairs of truncation thresholds.

[0282] Clause A12. The apparatus of clause A11, wherein the condition for continuing the search comprises at least one of the following:

[0283] The number of searches already conducted is less than the total number of searches scheduled;

[0284] The difference between the mean of the absolute values ​​of each group of data in the current search and the mean of the absolute values ​​of the data to be quantified is greater than or equal to the difference threshold.

[0285] Clause A13. The apparatus of clause A10 or 11, further comprising:

[0286] A second determination module determines the maximum absolute value of the data in the data to be quantified;

[0287] A third determination module determines a plurality of first truncation thresholds based on the maximum absolute value and the truncation logarithm;

[0288] The fourth determining module obtains the plurality of pairs of truncation thresholds according to the plurality of first truncation thresholds and the second truncation thresholds.

[0289] Clause A14. The apparatus of clause A10, wherein the winograd convolution processing comprises:

[0290] Decomposing the Winograd forward transformation of the data to be operated into a summation operation, and calculating to obtain the Winograd forward transformation result of each data in the data to be operated;

[0291] Performing a bitwise multiplication operation between the winograd forward transformation results of the corresponding data in the data to be operated to obtain a bitwise multiplication result;

[0292] Decompose the inverse winograd transform of the bitwise multiplication result into a summation operation to obtain the winograd convolution result.

[0293] The data to be quantized is any one of the data to be calculated, the winograd forward transformation result of the data to be calculated, and the bitwise multiplication result.

[0294] Clause A15. The apparatus of clause A14, wherein the first quantization module is further configured to perform any of the following operations:

[0295] Before decomposing the Winograd forward transformation of the data to be operated into a summation operation, the data to be operated is used as data to be quantized for quantization;

[0296] Before performing the bitwise multiplication operation, the winograd forward transformation result of each data in the data to be operated is used as the data to be quantized for quantization;

[0297] Before performing the inverse winograd transform and decomposing it into a summation operation, the bitwise multiplication result is used as the data to be quantized and quantized.

[0298] Clause A16. The apparatus according to clause A14, wherein the step of decomposing the Winograd transformation of the data to be operated into a summation operation and calculating the Winograd transformation result of each data in the data to be operated comprises:

[0299] Each data in the data to be calculated is decomposed into a plurality of first sub-tensors, and a Winograd positive transformation is performed on the plurality of first sub-tensors of each data in the data to be calculated, and the sums are obtained to obtain a Winograd positive transformation result of each data in the data to be calculated.

[0300] Among them, the number of multiple first sub-tensors split from each data is the same as the number of non-zero elements in the corresponding data, and one element in each first sub-tensor is the same as the element at the corresponding position in the corresponding data, and the other elements are all 0.

[0301] Clause A17. The apparatus of clause A14, wherein the step of decomposing the inverse winograd transform of the bitwise multiplication result into a summation operation to obtain the winograd convolution result comprises:

[0302] Decomposing the bitwise multiplication result into a plurality of second sub-tensors, performing an inverse Winograd transformation on the plurality of second sub-tensors and summing them, to obtain a Winograd convolution result of the data to be operated;

[0303] Among them, the number of the multiple second sub-tensors is the same as the number of non-zero elements in the bitwise multiplication result, and each of the multiple second sub-tensors has an element that is the same as the element at the corresponding position in the bitwise multiplication result, and the other elements are all 0.

[0304] Item A18. In the apparatus according to Item A14, the data to be calculated includes at least one of input neurons, weights, and gradients.

[0305] Clause A19. An artificial intelligence chip, comprising a data processing device as described in any one of Clauses A10 to A18.

[0306] Item A20. An electronic device comprising an artificial intelligence chip as described in Item A19.

[0307] Clause A21. A board comprising: a storage device, an interface device, a control device, and an artificial intelligence chip as described in Clause A19;

[0308] Wherein, the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively;

[0309] The storage device is used to store data;

[0310] The interface device is used to realize data transmission between the artificial intelligence chip and external equipment;

[0311] The control device is used to monitor the status of the artificial intelligence chip.

[0312] Clause A22. A card according to Clause A21,

[0313] The storage device comprises: a plurality of groups of storage units, each group of the storage units is connected to the artificial intelligence chip via a bus, and the storage units are: DDR SDRAM;

[0314] The chip includes: a DDR controller for controlling data transmission and data storage of each storage unit;

[0315] The interface device is: a standard PCIE interface.

[0316] Clause A23. An electronic device comprising:

[0317] processor;

[0318] a memory for storing processor-executable instructions;

[0319] The processor is configured to call the instructions stored in the memory to execute the method described in any one of clauses A1 to A9.

[0320] Clause A24. A computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the method described in any one of Clauses A1 to A9.

[0321] The embodiments of the present disclosure are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of ​​the present disclosure. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present disclosure, the specific implementation methods and the scope of application of the present disclosure, all belong to the scope of protection of the present disclosure. In summary, the content of this specification should not be understood as a limitation on the present disclosure.

Claims

1. A data processing method, characterized in that: Applied to a processor, the method comprises: The difference between the means of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using multiple pairs of truncation thresholds is used as an evaluation index, and a pair of truncation thresholds is determined from the multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in a winograd convolution process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value of the data to be quantized, and the data to be quantized is data used by the processor for processing in a corresponding application scenario, and the data to be quantized is at least one of the following: image data, video data, and audio data, and the application scenario includes any one of image processing, video processing, and audio processing; quantize the data to be quantized according to the determined pair of truncation thresholds to obtain quantized data, wherein the pair of truncation thresholds are used to improve the quantization accuracy of the data to be quantized used in the processing of the processor; Continue to perform winograd convolution processing according to the quantized data to obtain a quantized winograd convolution result; Performing dequantization processing on the quantized winograd convolution result to obtain a winograd convolution result; The winograd convolution process includes: Decomposing the Winograd forward transformation of the data to be operated into a summation operation, and calculating to obtain the Winograd forward transformation result of each data in the data to be operated; Performing a bitwise multiplication operation between the winograd forward transformation results of the corresponding data in the data to be operated to obtain a bitwise multiplication result; The inverse winograd transform of the bitwise multiplication result is decomposed into a summation operation to obtain the winograd convolution result.

2. The method according to claim 1, characterized in that The difference between the means of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using multiple pairs of truncation thresholds is used as an evaluation index, and a pair of truncation thresholds is determined from the multiple pairs of truncation thresholds, including: In the current round of search, multiple pairs of cutoff thresholds are used to quantize the data to be quantized to obtain multiple groups of quantized data; Determine a pair of to-be-selected truncation thresholds from the multiple pairs of truncation thresholds according to the difference between the mean of the absolute values ​​of each group of data and the mean of the absolute values ​​of the data to be quantified; When the current round of search meets the condition for continuing the search, a new multiple pairs of truncation thresholds are determined according to the to-be-selected truncation thresholds, and the next round of search is performed according to the new multiple pairs of truncation thresholds until the current round of search does not meet the condition for continuing the search; When the current round of search does not satisfy the condition for continuing the search, the to-be-selected truncation threshold is determined to be a pair of truncation thresholds determined from multiple pairs of truncation thresholds.

3. The method according to claim 2, characterized in that The continuing search condition includes at least one of the following: The number of searches already conducted is less than the total number of searches scheduled; The difference between the mean of the absolute values ​​of each group of data in the current search and the mean of the absolute values ​​of the data to be quantified is greater than or equal to the difference threshold.

4. The method according to claim 1 or 2, characterized in that: The method further comprises: Determine the maximum absolute value of the data in the data to be quantified; Determining a plurality of first truncation thresholds based on the maximum absolute value and the truncation logarithm; The plurality of pairs of truncation thresholds are obtained according to the plurality of first truncation thresholds and the second truncation thresholds.

5. The method according to claim 1, characterized in that The data to be quantized is any one of the data to be calculated, a winograd forward transformation result of the data to be calculated, and the bitwise multiplication result.

6. The method according to claim 5, characterized in that The step of quantizing the data to be quantized according to the determined pair of cutoff thresholds to obtain quantized data includes any of the following operations: Before decomposing the Winograd forward transformation of the data to be operated into a summation operation, the data to be operated is used as data to be quantized for quantization; Before performing the bitwise multiplication operation, the winograd forward transformation result of each data in the data to be operated is used as the data to be quantized for quantization; Before performing the inverse winograd transform and decomposing it into a summation operation, the bitwise multiplication result is used as the data to be quantized and quantized.

7. The method according to claim 1, characterized in that The Winograd forward transformation of the data to be operated is decomposed into a summation operation, and the Winograd forward transformation result of each data in the data to be operated is obtained by calculation, including: Each data in the data to be calculated is decomposed into a plurality of first sub-tensors, and a Winograd positive transformation is performed on the plurality of first sub-tensors of each data in the data to be calculated, and the sums are obtained to obtain a Winograd positive transformation result of each data in the data to be calculated. Among them, the number of multiple first sub-tensors split from each data is the same as the number of non-zero elements in the corresponding data, and one element in each first sub-tensor is the same as the element at the corresponding position in the corresponding data, and the other elements are all 0.

8. The method according to claim 1, characterized in that The step of decomposing the inverse winograd transform of the bitwise multiplication result into a summation operation to obtain the winograd convolution result includes: Decomposing the bitwise multiplication result into a plurality of second sub-tensors, performing an inverse Winograd transformation on the plurality of second sub-tensors and summing them, to obtain a Winograd convolution result of the data to be operated; Among them, the number of the multiple second sub-tensors is the same as the number of non-zero elements in the bitwise multiplication result, and each of the multiple second sub-tensors has an element that is the same as the element at the corresponding position in the bitwise multiplication result, and the other elements are all 0.

9. The method according to claim 5, characterized in that The data to be calculated includes at least one of input neurons, weights and gradients.

10. A data processing device, characterized in that: Applied to a processor, the device comprises: A first determination module uses the difference between the means of the absolute values ​​of the quantized data obtained by quantizing the data to be quantized using multiple pairs of truncation thresholds as an evaluation index, and determines a pair of truncation thresholds from the multiple pairs of truncation thresholds, wherein the data to be quantized is a group of data in the winograd convolution processing process, and each pair of truncation thresholds in the multiple pairs of truncation thresholds includes a first truncation threshold and a second truncation threshold, wherein the second truncation threshold is the minimum value of the data to be quantized, and the data to be quantized is data used by the processor for processing in a corresponding application scenario, and the data to be quantized is at least one of the following: image data, video data, and audio data, and the application scenario includes any one of image processing, video processing, and audio processing; a first quantization module, performing quantization processing on the data to be quantized according to the determined pair of truncation thresholds to obtain quantized data, wherein the pair of truncation thresholds are used to improve the quantization accuracy of the data to be quantized used in the processing of the processor; A convolution processing module, further performing winograd convolution processing according to the quantized data to obtain a quantized winograd convolution result; A dequantization processing module performs dequantization processing on the quantized winograd convolution result to obtain a winograd convolution result; The winograd convolution process includes: Decomposing the Winograd forward transformation of the data to be operated into a summation operation, and calculating to obtain the Winograd forward transformation result of each data in the data to be operated; Performing a bitwise multiplication operation between the winograd forward transformation results of the corresponding data in the data to be operated to obtain a bitwise multiplication result; The inverse winograd transform of the bitwise multiplication result is decomposed into a summation operation to obtain the winograd convolution result.

11. An artificial intelligence chip, characterized in that: The chip comprises the data processing device according to claim 10.

12. An electronic device, characterized in that: The electronic device comprises the artificial intelligence chip as claimed in claim 11.

13. A board, characterized in that: The board includes: a storage device, an interface device and a control device and the artificial intelligence chip according to claim 11; Wherein, the artificial intelligence chip is connected to the storage device, the control device and the interface device respectively; The storage device is used to store data; The interface device is used to realize data transmission between the artificial intelligence chip and external equipment; The control device is used to monitor the status of the artificial intelligence chip.

14. The board according to claim 13, characterized in that: The storage device comprises: a plurality of groups of storage units, each group of the storage units is connected to the artificial intelligence chip via a bus, and the storage units are: DDR SDRAM; The chip includes: a DDR controller for controlling data transmission and data storage of each storage unit; The interface device is: a standard PCIE interface.

15. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in any one of claims 1 to 9.

16. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.