A data processing method and related equipment

By quantifying the activation values ​​in the model, the problem of high bandwidth pressure in data processing is solved and the computing power is improved.

CN112748899BActive Publication Date: 2025-08-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010512058.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-08
Publication Date
2025-08-22
Estimated Expiration
2040-06-08

AI Technical Summary

Technical Problem

In the prior art, the computing bandwidth pressure on 32-bit floating point data during data processing is high, resulting in a decrease in computing power.

Method used

By quantizing the activation value in the model, quantizing it into an integer value, and performing forward calculation and inverse quantization after quantization, the bandwidth pressure of data processing is reduced.

Benefits of technology

Without significantly affecting the data processing results, the computing power of the data processing equipment is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112748899B_ABST
    Figure CN112748899B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a data processing method based on artificial intelligence and related equipment. The method includes: for input parameters that need to be processed, after inputting them into the model, the first original activation value of the first target layer can be obtained, the first original activation value is quantized, and the corresponding first quantized activation value is determined, and the first quantized activation value is within the integer value range. That is, the first original activation value is quantized into an integer value. In this way, forward calculation is performed based on the quantized first quantized activation value and the weight of the first target layer. After the first quantized activation value completes the forward calculation through the first target layer, the result of the forward calculation can be dequantized according to the quantization method of the first original activation value to obtain the output result of the first target layer. After the calculation of the input parameter is completed by the model, the data corresponding to the input parameter is determined. This method improves the computing power of the data processing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a data processing method and related equipment. Background Art

[0002] In some data processing scenarios, data is typically input into a model corresponding to the scenario, and the corresponding results are obtained through calculations at each layer of the model. The activation values ​​involved in the calculations at each layer of the model are typically 32-bit floating-point data.

[0003] For example, when using a speech noise reduction model to reduce speech noise, after speech data is input into the model, the activation values ​​involved in the calculation of each layer in the model are typically corresponding 32-bit floating-point data. After the model performs operations, the noise-reduced speech is obtained. The activation values ​​can refer to the input data or output data of each layer in the model.

[0004] This data processing method requires calculations on 32-bit data, which puts a lot of pressure on the bandwidth of data processing and reduces computing power. Summary of the Invention

[0005] In order to solve the above technical problems, the present application provides a data processing method and related equipment, which reduces the bandwidth pressure of data processing and improves the computing power of data processing equipment.

[0006] The embodiments of this application disclose the following technical solutions:

[0007] In one aspect, an embodiment of the present application provides a data processing method, the method comprising:

[0008] After inputting the input parameters into the model, obtaining a first original activation value of a first target layer, where the first target layer is any layer in the model;

[0009] quantizing the first original activation value to determine a corresponding first quantized activation value, wherein the first quantized activation value is within an integer value range;

[0010] Perform forward calculation based on the first quantized activation value and the weight of the first target layer;

[0011] Dequantize the result of the forward calculation according to the quantization method of the first original activation value to obtain an output result of the first target layer;

[0012] After the calculation of the input parameters is completed by the model, data corresponding to the input parameters are determined.

[0013] Optionally, the first original activation value or the second original weight is used as the second target parameter, and the second target parameter is quantized to determine the corresponding second quantization parameter as follows:

[0014] determining a second target maximum value of the absolute value corresponding to the second target parameter;

[0015] Determine a third product of a third value corresponding to the second target parameter and the second integer characteristic number, wherein the third value is a quotient of the second target parameter and the second target maximum value;

[0016] Determine an integer value corresponding to the third product as a second quantization parameter corresponding to the second target parameter, when the second target parameter is the first original activation value, the second quantization parameter is the first quantized activation value, when the second target parameter is the second original weight, the second quantization parameter is the second quantization weight.

[0017] On the other hand, an embodiment of the present application provides a data processing device, the device comprising:

[0018] an acquiring unit, configured to acquire a first original activation value of a first target layer after inputting the input parameters into the model, where the first target layer is any layer in the model;

[0019] a quantization unit, configured to quantize the first original activation value to determine a corresponding first quantized activation value, wherein the first quantized activation value is within an integer value range;

[0020] a computing unit, configured to perform forward computation based on the first quantized activation value and the weight of the first target layer;

[0021] a dequantization unit, configured to dequantize the result of the forward calculation according to the quantization method of the first original activation value to obtain an output result of the first target layer;

[0022] A determination unit is configured to determine data corresponding to the input parameter after the calculation of the input parameter is completed by the model. On the other hand, an embodiment of the present application provides a device, the device comprising a processor and a memory:

[0023] The memory is used to store program code and transmit the program code to the processor;

[0024] The processor is configured to perform the above method according to the instructions in the program code.

[0025] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the above method.

[0026] As can be seen from the above technical solution, after inputting input parameters requiring data processing into the model, the first raw activation value of the first target layer (any layer in the model) can be obtained. The first raw activation value is quantized to determine a corresponding first quantized activation value, which is within an integer range. In other words, the first raw activation value is quantized to an integer. In this manner, a forward calculation is performed based on the quantized first quantized activation value and the weight of the first target layer. After the forward calculation of the first quantized activation value is completed by the first target layer, the result of the forward calculation is dequantized based on the quantization method used for the first raw activation value to obtain the output result of the first target layer. This ensures that the difference between the output result and the result obtained by forward calculation using the first raw activation value is within an acceptable range. After the model completes the calculation of the input parameters, the data corresponding to the input parameters is determined. In this method, by quantizing the first raw activation value of the first target layer to an integer value with fewer bits, data processing bandwidth pressure is reduced and the computing power of the data processing equipment is improved, while minimizing the impact on the data processing results. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0028] Figure 1 A schematic diagram of an application scenario of a data processing method provided in an embodiment of the present application;

[0029] Figure 2 A flow chart of a data processing method provided in an embodiment of the present application;

[0030] Figure 3 This is a diagram showing the effect of speech noise reduction using a speech noise reduction model provided in an embodiment of the present application;

[0031] Figure 4 A flow chart of a hybrid quantization training method provided in an embodiment of the present application;

[0032] Figure 5 A flow chart of a dynamic quantitative reasoning method provided in an embodiment of the present application;

[0033] Figure 6 This is a comparison diagram of the effects provided by the embodiments of the present application;

[0034] Figure 7 A structural diagram of a data processing device provided in an embodiment of the present application;

[0035] Figure 8 A structural diagram of a data processing device provided in an embodiment of the present application;

[0036] Figure 9 A structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] The embodiments of the present application are described below with reference to the accompanying drawings.

[0038] Currently, data processing methods usually require calculations on 32-bit data, which puts a lot of pressure on the bandwidth of data processing and reduces computing performance.

[0039] To this end, an embodiment of the present application provides a data processing method, which can reduce the bandwidth pressure of data processing and improve the computing power of the data processing device by quantizing the first original activation value of the first target layer into an integer value with fewer bits, while having little impact on the data processing results.

[0040] The data processing method provided in the embodiments of the present application can be implemented based on artificial intelligence. Artificial Intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0041] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0042] In the embodiments of this application, the main artificial intelligence software technologies involved include the above-mentioned speech processing technology, natural language processing technology, and deep learning.

[0043] For example, it may involve speech recognition technology in speech technology, including speech signal preprocessing, speech signal frequency analysis, speech signal feature extraction, speech signal feature matching / recognition, speech training, etc.

[0044] For example, it may involve deep learning in machine learning (ML), including various types of artificial neural networks.

[0045] First, the execution subject of the embodiment of the present application is introduced. The model training method provided in the present application can be executed by a data processing device. The model involved in the data processing method can be deployed in the data processing device, and the data processing device can be a server, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The data processing device can be a server, and the terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected by wired or wireless communication, and this application does not limit this.

[0046] This data processing device can be capable of implementing voice technologies such as automatic speech recognition (ASR) and voiceprint recognition. Voice technology enables data processing devices to hear, see, and feel, and is the future development direction of human-computer interaction. Among them, voice is becoming one of the most promising human-computer interaction methods in the future.

[0047] In an embodiment of the present application, the data processing device can perform voice signal preprocessing, voice signal frequency domain analysis, etc. on the acquired audio by implementing the above-mentioned voice technology to perform audio denoising, etc.

[0048] The data processing device may possess machine learning (ML) capabilities. ML is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of artificial intelligence. Machine learning and deep learning typically include technologies such as artificial neural networks.

[0049] In the embodiments of the present application, the model used for training by the model training method mainly involves the application of various artificial neural networks, such as sequence generation through a neural network model.

[0050] It should be noted that the embodiments of the present application do not limit the model type for model training using this method. The model can be any type of model. In one possible implementation, the model can be a recurrent neural network (RNN) model.

[0051] In addition, the technical solutions provided in the embodiments of this application are mainly used in the neural network forward computing library. Based on the neural network forward computing library, the computing power of all neural network algorithms is provided. Therefore, the application scenarios of this application are the same as those using the models in the neural network forward library. The application scenarios mainly include AI algorithm-related applications, including speech noise reduction, sequence generation, speech analysis and other application scenarios.

[0052] When applied to speech noise reduction scenarios, the training samples corresponding to the model can be speech samples including noise reduction labels. When applied to sequence generation scenarios, the training samples corresponding to the model can be sequence samples including generated sequence labels. When applied to speech analysis scenarios, the training samples corresponding to the model can be speech samples including speech analysis content labels. For these application scenarios, model training using the model training method provided in this application can improve model training efficiency.

[0053] Next, the data processing method provided in the embodiment of this application is introduced with the server as the execution subject and combined with the actual application scenario.

[0054] See also Figure 1 , which shows a schematic diagram of an application scenario of a data processing method provided by an embodiment of the present application. Figure 1 As shown, the application scenario includes a server 101, and the server 101 executes the data processing method provided in the embodiment of the present application.

[0055] In an embodiment of the present application, when data processing is required for input parameters, the server 101 may input the input parameters into a model for data processing to determine the data corresponding to the input parameters through the model.

[0056] The model can be a model in the neural network forward computing library, which provides the computing power of all neural network algorithms. Therefore, the application scenarios of this application are the same as those using the model in the neural network forward computing library, including speech analysis, speech noise reduction, speech translation, text translation, text recognition, sequence and other scenarios.

[0057] In a speech analysis scenario, the model may be a speech analysis model, the input parameters may be the speech data to be analyzed, and the data corresponding to the determined input parameters may be the data after the speech analysis is completed. In a speech noise reduction scenario, the model may be a speech noise reduction model, the input parameters may be the speech data to be denoised, and the data corresponding to the determined input parameters may be the speech data after the denoising is performed on the speech data to be denoised.

[0058] In the case of speech translation, the model can be a speech translation model, the input parameters can correspond to the speech data to be translated, and the data corresponding to the determined input parameters can be the text data obtained by the translation. In the case of sequence generation, the model can be a sequence generation model, the input parameters can be the data comprising the sequence to be generated, and the data corresponding to the determined input parameters can be the sequence obtained by data processing based on the sequence to be generated, etc., and will not be further elaborated.

[0059] After inputting the input parameters into the model, a first raw activation value of the first target layer in the model can be obtained. The first target layer can be any layer in the model, and the first raw activation value can be the activation value of the first target layer. The activation value mentioned in the embodiments of the present application can be the input data or output data of any layer in the model, and the data type of the first raw activation value is floating point.

[0060] For example, see Figure 1 , the server 101 can use the linear superposition layer in the model as the first target layer and obtain the first original activation value of the first target layer, which is a one-dimensional sequence [-0.127, 0.126, 0.08, -0.07].

[0061] After obtaining the first raw activation values, server 101 may quantize the first raw activation values ​​to determine a quantized activation value corresponding to each first raw activation value, which is recorded as a first quantized activation value. The quantized first quantized activation value is within an integer value range, that is, the first raw activation value is quantized to an integer value.

[0062] In this embodiment, the first original activation value can be quantized to the data range [-127, 127] by scaling it up by a factor of 1000. Thus, the first quantized activation value determined is: "-127, 126, 8, -7", resulting in a one-dimensional sequence [-127, 126, 8, -7].

[0063] Thus, forward calculation is performed based on the first quantized activation value obtained by quantizing the first original activation value and the weight of the first target layer.

[0064] After the calculation is completed, the result of the forward calculation can be inversely quantized according to the quantization method of the first original activation value to obtain the output result of the first target layer, so as to reduce the impact of quantizing the first original activation value on the output result obtained by the forward calculation. That is to say, the difference between the result obtained by calculating the first original activation value and the weight of the first target layer and the result obtained by calculating the first quantized activation value and the weight of the first target layer is within an allowable range.

[0065] In this embodiment, the result of the forward calculation can be scaled 1000 times according to the quantization method to achieve inverse quantization. Figure 1 As shown in the figure, after forward calculation based on the first quantized activation value and the weight of the first target layer, a sequence of [102, 103, -76, 8] is obtained. The data in the sequence can be classified and scaled 1000 times to obtain the sequence [0.102, 0.103, -0.76, 0.08], which is recorded as the output result of the first target layer.

[0066] After the calculation of the input parameters is completed through the model, the data corresponding to the input parameters is determined.

[0067] Among them, since the output result of the first target layer is obtained, in this method, under the premise of not affecting the data processing results as much as possible, the bandwidth pressure of data processing is reduced and the computing power of the data processing equipment is improved.

[0068] Next, we will take the server as the above-mentioned data processing device and the voice noise reduction scenario as an example to introduce the data processing method provided by the embodiment of the present application. Among them, the above-mentioned model is deployed in the server, and the model can be a model obtained by completing training. The data processing method is the inference process for the model. Figure 2 , which shows a flow chart of a data processing method provided by an embodiment of the present application, the method may include:

[0069] S201: After inputting the input parameters into the model, obtaining the first original activation value of the first target layer.

[0070] The first target layer is any layer in the model, such as any layer in the speech noise reduction model.

[0071] The first raw activation value of the first target layer is the data generated when the input parameters are input into the model and then calculated. In other words, it refers to the input data or output data of the first target layer in the model. When the first target layer is the first layer of the model, the first raw activation value can be the input parameter. In a specific implementation, the first raw activation value can be represented as Input'[0,1,…,n], which also represents a one-dimensional sequence of floating-point data with an input length of n.

[0072] In an embodiment of the present application, before the original activation value is calculated through the first target layer, the original activation value of the first target layer can be obtained and recorded as the first original activation value.

[0073] In actual scenarios, one or more layers of the model may be used as the first target layer, or all layers in the model may be used as the first target layer for data processing.

[0074] S202: Quantize the first original activation value to determine a corresponding first quantized activation value.

[0075] The first quantized activation value determined after quantizing the first original activation value is within the integer value range.

[0076] That is, in S202 , the first original activation value may be quantized into an integer value through a quantization method.

[0077] The embodiment of the present application does not limit the quantization method of the first original activation value, and quantization can be performed according to actual needs.

[0078] In a specific implementation, the first quantized activation value obtained by quantization can be within an 8-bit integer value range, and the integer value range is [-127, 127]. That is, the first original activation value can be quantized into 8-bit integer data as its corresponding first quantized activation value.

[0079] S203: Perform forward calculation according to the first quantized activation value and the weight of the first target layer.

[0080] S204: Dequantize the result of the forward calculation according to the quantization method of the first original activation value to obtain the output result of the first target layer.

[0081] Since the first original activation value is quantized into an integer value, the quantized integer value may be significantly different from the first original activation value. Therefore, the corresponding inverse quantization method can be determined according to the quantization method to inverse quantize the result of the forward calculation, so that the difference between the output result of the first target layer and the result calculated directly based on the first original activation value is within an allowable range.

[0082] In a specific implementation, when the quantization method is amplification by A times, the dequantization method may be scaling by A times. The degree of scaling the result of the forward calculation includes scaling the result after calculating the quantized first original activation value so that the difference between the scaled result and the result calculated when the first original activation value is not quantized is within a preset range, that is, an allowable range.

[0083] S205: After completing the calculation of the input parameters through the model, determining the data corresponding to the input parameters.

[0084] As can be seen from the above technical solution, after inputting input parameters requiring data processing into the model, the first raw activation value of the first target layer (any layer in the model) can be obtained. The first raw activation value is quantized to determine a corresponding first quantized activation value, which is within an integer range. In other words, the first raw activation value is quantized to an integer. In this manner, a forward calculation is performed based on the quantized first quantized activation value and the weight of the first target layer. After the forward calculation of the first quantized activation value is completed by the first target layer, the result of the forward calculation is dequantized based on the quantization method used for the first raw activation value to obtain the output result of the first target layer. This ensures that the difference between the output result and the result obtained by forward calculation using the first raw activation value is within an acceptable range. After the model completes the calculation of the input parameters, the data corresponding to the input parameters is determined. In this method, by quantizing the first raw activation value of the first target layer to an integer value with fewer bits, data processing bandwidth pressure is reduced and the computing power of the data processing equipment is improved, while minimizing the impact on the data processing results.

[0085] In model training techniques, when quantizing raw activation values, the original activation values ​​are typically scaled to integer data, such as 8-bit data, and then the scaled integer data is scaled using a corresponding scaling factor to restore the original activation data. For this model training method, it is necessary to save the scaling factor (quantization parameter) corresponding to the training samples for subsequent activation value quantization during model inference.

[0086] In this way, since the quantization parameters are obtained based on the training samples, the quantization parameters are limited by the numerical range of the training samples. When the input data in the inference process is not within the numerical range of the training samples during training, the activation values ​​quantized by the saved quantization parameters will still be quantized to the smaller numerical range corresponding to the training samples. In other words, the quantization parameters obtained by static quantization training are strongly dependent on the characteristics of the training samples and limit the data range of the activation values. It is difficult to guarantee a good effect on other data outside the training sample data range, resulting in reduced accuracy in the model inference process. Experiments have also found that the training effect of non-classification models trained using static quantization training is unacceptable.

[0087] To this end, the training method of the above model in the embodiment of the present application is as follows:

[0088] S301: In the process of training the initial model for the i-th time using the training sample, a second original activation value of the second target layer is obtained.

[0089] The second target layer is any layer in the initial model. Each layer in the initial model can be used as the second target layer to train the model. The second original activation value can be the input data or output data of the second target layer.

[0090] Next, we will take the sound noise reduction model as an example to illustrate.

[0091] The second target layer for activation value quantization can be any layer in the speech noise reduction model, and this application does not limit this. The second original activation value can be the input data of the second target layer. In a specific implementation, the second original activation value can be represented as Input[0,1,…,n], which represents a one-dimensional sequence of floating-point data with an input length of n.

[0092] In an embodiment of the present application, the second original activation value of the second target layer may be obtained before the second original activation value is used to perform calculations on the second target layer.

[0093] S302: quantize the second original activation value according to the first numerical range of the second original activation value to determine a corresponding second quantized activation value.

[0094] The second quantized activation value obtained by quantizing the second original activation value is still within the first value range. In other words, the quantization method for the second original activation value in this application is a pseudo quantization method.

[0095] In an embodiment of the present application, during the model training process, the activation value is quantized based on the second original activation value range of the second target layer, and the quantization coefficients such as the scaling ratio for the activation value quantization during the training process are not stored. During the inference process, the activation value can still be dynamically quantized based on the input data, that is, the data range of the activation value itself. This training method can be a dynamic quantization training method for the activation value. Based on the model trained by this dynamic quantization training method, during the inference process, the activation value is only quantized without restricting the data range, thereby improving the model accuracy.

[0096] S303: Perform forward calculation according to the second quantized activation value and the weight of the second target layer.

[0097] S304: After completing the training of the initial model, determine the weight of the initial model as the target weight of the model.

[0098] In an embodiment of the present application, after completing the speech noise reduction model training, the obtained speech noise reduction model weights and the corresponding model architecture can be saved to subsequently implement data inference through the speech noise reduction model, that is, to perform speech noise reduction through the speech noise reduction model.

[0099] See also Figure 3 , which shows an effect diagram of speech noise reduction by a speech noise reduction model provided by an embodiment of the present application, such as Figure 3 As shown, it includes a speech segment a without speech noise reduction, and a speech segment b after speech noise reduction by the speech noise reduction model trained by the model training method of an embodiment of the present application. The speech noise of the speech segment after speech noise reduction by the speech noise reduction model is relatively reduced.

[0100] In this manner, during the i-th training of the initial model using training samples, the second original activation value of the second target layer can be obtained. The second target layer can be any layer in the initial model. The second original activation value is quantized according to a first numerical range of the second original activation value to determine a second quantized activation value corresponding to the second original activation value. The second quantized activation value is within the first numerical range. In other words, the second original activation value is quantized to the numerical range of the second original activation value. Thus, forward calculations are performed based on the second quantized activation value and the weight of the second target layer. After completing training for the initial model, the weight of the initial model is determined to be the target weight of the model. This method quantizes the irregular second original activation value to a small number of regular quantized values, i.e., to the corresponding second quantized activation value. This allows calculations to be performed only on the small number of regular second quantized activation values ​​corresponding to the second original activation value during the forward calculation process, thereby improving calculation speed and, in turn, model training efficiency.

[0101] In an embodiment of the present application, to further improve the efficiency of model training, in one possible implementation, the method further includes:

[0102] S401: quantize the first original weight of the second target layer according to a second numerical range of the first original weight to determine a corresponding first quantized weight.

[0103] Among them, the first original weight of the second target layer can be used to reflect the importance of each activation value in the layer. Under normal circumstances, the first original weight is floating-point data. Among them, the first quantized weight obtained by quantizing the first original weight is still within the second numerical range. That is to say, the quantization method for the first original weight in this application is a pseudo-quantization method. In a specific implementation, the first original weight weights[(0,0),(0,1),…,(m,n)] represents sequence data with an input length of m*n.

[0104] Thus, in S303, forward calculation is performed according to the second quantized activation value and the weight of the second target layer, including:

[0105] S402: Perform forward calculation according to the second quantized activation value and the first quantized weight.

[0106] It can be understood that this solution saves the weights of the model for use in the inference process, which is a process of statically quantizing the first original weights.

[0107] This training method further improves the training efficiency by performing dual quantization on the activation values ​​and weights. And this hybrid quantization training method performs static quantization on the first original weight and dynamic quantization on the second original activation value. The dynamic quantization of the second original activation value can adaptively obtain the appropriate quantization parameters for all samples. Although the dynamic quantization process requires caching the intermediate results, the bottleneck for the Long Short-Term Memory Network (LSTM) and the fully connected layer is that the time consumed for weight loading far exceeds the size of the input / output. Therefore, the time-consuming overhead of this additional buffering can be basically ignored. In terms of accuracy, the generalization accuracy of the dynamic quantization of the second original activation value is better than that of static quantization, which can meet the needs of implementation.

[0108] The embodiment of the present application does not limit the quantization method for the second original activation value and the first original weight. According to the actual scenario or different needs, a suitable method can be selected to quantize the second original activation value and the first original weight.

[0109] The embodiment of the present application provides two quantization methods for the second original activation value and the first original weight.

[0110] The first quantification method:

[0111] The second original activation value or the first original weight is used as the first target parameter. Then, the first target parameter is quantized to determine the corresponding first quantization parameter as follows:

[0112] S501: Determine a first target numerical range of the first target parameter according to a first target maximum value of the absolute value corresponding to the first target parameter.

[0113] It can be understood that the first target parameter can be a positive or negative value. Therefore, in the embodiment of the present application, the maximum absolute value corresponding to the first target parameter can be determined and recorded as the first target maximum value. Among them, when the first target parameter is the second original activation value, the first target maximum value can be the maximum absolute value corresponding to the second original activation value. Let the first target maximum value of the absolute value corresponding to the second original activation value be MaxInput, and the calculation formula of MaxInput is:

[0114] MaxInput=Max(fabs(Input[0,1,…,n])).

[0115] Among them, fabs is the function for finding the absolute value, and Max is the function for finding the maximum value.

[0116] When the first target parameter is the first original weight, if the first original weight changes greatly in each iterative training, the model data will not converge. To this end, in one possible implementation, when the first target parameter is the first original weight, the method of determining the first target maximum value of the absolute value corresponding to the first target parameter in S401 includes:

[0117] According to the maximum absolute value corresponding to the first original weight and the maximum absolute value corresponding to the first original weight of the second target layer during the i-1th training process, the first target maximum absolute value corresponding to the first original weight is determined.

[0118] That is to say, based on the maximum absolute value corresponding to the first original weight in this round of training, i.e., the i-th training, and the maximum absolute value corresponding to the first original weight in the previous round, i.e., the i-1-th training, the target maximum absolute value corresponding to the original weight of this round is determined.

[0119] When determining the first target maximum value of the absolute value corresponding to the first original weight in the first training, the maximum value of the absolute value corresponding to the first original weight in the 0th training can be set to 0.

[0120] In a specific implementation, the maximum absolute value corresponding to the first original weight in the last training, i.e., the i-1th training, can be set as MaxWeightHistory. The calculation formula of MaxWeightHistory is:

[0121] InitialMaxWeights=Max(fabs(weights[(0,0),(0,1),…,(m,n)]));

[0122] MaxWeightHistory=InitialMaxWeights.

[0123] Let the maximum absolute value of the first original weight in this i-th training be CurrentMaxWeight, and the calculation formula of CurrentMaxWeight is:

[0124] CurrentMaxWeight=Max(fabs(weights[(0,0),(0,1),…,(m,n)])).

[0125] Let the first target maximum value of the absolute value corresponding to the first original weight in this i-th training be MaxWeights. The calculation formula of MaxWeights is:

[0126] MaxWeights=MaxWeightHistory+α(CurrentMaxWeight-MaxWeightHistory).

[0127] The α is the learning update rate parameter of the weight, which is used to control the speed of weight update.

[0128] This method smoothes the first original weight by performing a sliding weighted average on the maximum value of the first original weight, thereby reducing the probability of jitter of the first original weight and improving the possibility of convergence.

[0129] After determining the first target maximum value of the absolute value corresponding to the first target parameter, a first target numerical range for quantizing the first target parameter can be determined based on the first target maximum value. In a specific implementation, let the first target maximum value be A, and the first target numerical range can be [-A, A].

[0130] S502: Determine a first target number of first quantized values ​​that meet the first target value range.

[0131] The embodiment of the present application does not limit the first target number. The first target number can be a number that is determined according to actual needs and is suitable for the first target numerical range.

[0132] In the embodiment of the present application, the first target number can be set to 256 based on 8-bit integer data. Thus, according to the 256 first quantized values ​​that meet the first target value range, the 256 first quantized values ​​within the first target data range can be divided according to the first target data range.

[0133] S503: Determine, according to the first target parameter and the first target number of quantized values, corresponding first quantized data as a first quantized parameter corresponding to the first target parameter.

[0134] When the first target parameter is the second original activation value, the first quantization parameter is the second quantized activation value; when the first target parameter is the first original weight, the quantization parameter is the first quantized weight.

[0135] In a specific implementation, the first quantization value closest to the first target parameter may be determined from these first quantization values ​​as the first quantization parameter of the first target parameter.

[0136] In this way, the second original activation value or the first original weight can be quantized to conform to the first target numerical range.

[0137] The second quantification method:

[0138] The second original activation value or the first original weight is used as the first target parameter, and the first target parameter is quantized to determine the corresponding first quantization parameter in the following manner:

[0139] S601: Determine a first target maximum value of the absolute value corresponding to the first target parameter.

[0140] The method for determining the first target maximum value of the absolute value corresponding to the first target parameter is as described in S501 above and will not be repeated here.

[0141] S602: Determine a first product of a first numerical value corresponding to the first target parameter and a first integer characteristic number, where the first numerical value is a quotient of the first target parameter and the first target maximum value.

[0142] The first integer characteristic number is the number of data obtained according to the number of bits of the integer data, which is 8. The first integer characteristic number is 127.

[0143] When the first target parameter is the second original activation value, the corresponding first product 1 is:

[0144] First product 1=(Input[0,1,…,n] / MaxInput)*127.

[0145] When the first target parameter is the first original weight, the corresponding first product 2 is:

[0146] The first product 2 = (weights[(0,0),(0,1),…,(m,n)] / MaxWeights)*127.

[0147] S603: Determine an integer value corresponding to the first product, and determine a second product of the integer value and a second value, where the second value is a quotient of the first target maximum value and the first integer characteristic number.

[0148] S604: Determine that the second product is a first quantization parameter corresponding to the first target parameter.

[0149] When the first target parameter is the second original activation value, the first quantization parameter is the second quantized activation value; when the first target parameter is the first original weight, the first quantization parameter is the first quantized weight.

[0150] When the first target parameter is the second original activation value, the corresponding second product 1 can be recorded as fqActivation:

[0151] fqActivation=round[(Input[0,1,…,n] / MaxInput)*127]*(MaxInput / 127).

[0152] When the first target parameter is the first original weight, the corresponding second product 1 can be recorded as fqweights:

[0153] fqweights=round[(weights[(0,0),(0,1),…,(m,n)] / MaxWeights)*127]*

[0154] (MaxWeights / 127).

[0155] Among them, round can be used for rounding operations.

[0156] In this way, the second original activation value or the first original weight can be quantized to conform to the first target numerical range.

[0157] In the embodiment of the present application, the weights in the inference process may also be quantified and then calculated. In one possible implementation, the method further includes:

[0158] S801: quantize the second original weight of the first target layer to determine a corresponding second quantized weight.

[0159] The second original weight may be a weight obtained after model training, that is, the second original weight may be known in advance before executing the method. Generally, the second original weight is floating-point data. In a specific implementation, the second original weight weights'[(0,0),(0,1),…,(m,n)] represents sequence data with an input length of m*n.

[0160] In a specific implementation, the S801 can be quantized online or offline. By using the offline quantization method, the consumption of computing power can be avoided and the inference time can be shortened.

[0161] The second quantized weight is within an 8-bit integer value range, which is [-127, 127]. That is, the second original weight can be quantized into 8-bit integer data as its corresponding second quantized weight.

[0162] Then, the above S203, performing forward calculation according to the first quantized activation value and the weight of the first target layer, includes:

[0163] S802: Perform forward calculation according to the first quantized activation value and the second quantized weight.

[0164] In the above S204, based on the quantization method of the first original activation value, the method of dequantizing the result of the forward calculation may include:

[0165] S803: Dequantize the result of the forward calculation according to the quantization method of the first original activation value and the second original weight.

[0166] Among them, the degree of dequantization of the result after the forward calculation includes: dequantizing the result after calculating the quantized second original weight so that the difference between the dequantized result and the result obtained when the second original weight is not quantized is within a preset range, that is, an allowable range. The vector width of the single instruction multiple data structure (SIMD) on the central processing unit (CPU) is a fixed length, for example, the width on the mobile terminal NEON is 128 bits (bit). As a result, the computing power provided by the device deployed with this model is limited. By quantizing the second original weight and the first original activation value into low-bit data, the computing power of the device can be effectively improved. For example, the width of the current device is mainly 128bit, 256bit, and 512bit. Assuming 256bit as an example, when the calculation data type is a floating-point data type, 8 can be calculated in parallel at a time, and when the calculation data type is an 8-bit integer, 32 can be calculated in parallel at a time.

[0167] Furthermore, compressing the second raw activation value and the first raw weight from 32-bit floating-point data to 8-bit integer data reduces the data bandwidth pressure on the device deploying the model by 1 / 4. This conversion to 8-bit integer data can reduce bandwidth bottlenecks and improve computing performance, especially for computational models like RNNs, which face significant bandwidth pressure.

[0168] Next, we will introduce the quantization method of the first original activation value or the second original weight in the model inference process. In one possible implementation, the first original activation value or the second original weight can be used as the target parameter, and the second target parameter can be quantized to determine the corresponding second quantization parameter as follows:

[0169] S901: Determine a second target maximum value of the absolute value corresponding to the second target parameter.

[0170] When the second target parameter is the first original activation value, the second target maximum value MaxInput' of the absolute value corresponding to the second target parameter is equal to Max(fabs(Input'[0,1,...,n])).

[0171] When the second target parameter is the second original weight, the second target maximum value MaxWeights' of the absolute value corresponding to the second target parameter is: MaxWeights'=Max(fabs(weights'[(0,0),(0,1),…,(m,n)])).

[0172] S902: Determine a third product of a third value corresponding to the second target parameter and a second integer characteristic number.

[0173] Among them, the third value is the quotient of the second target parameter and the second target maximum value. By calculating the third value of the second target parameter, the range of the second target parameter can be limited to [-1.0, 1.0], that is, the range of the first original activation value or the second original weight can be limited to [-1.0, 1.0].

[0174] When the second target parameter is the first original activation value, the corresponding third product 1' is:

[0175] The third product 1'=(Input'[0,1,...,n] / MaxInput')*127.

[0176] When the second target parameter is the second original weight, the corresponding third product 2' is:

[0177] The third product 2'=(weights'[(0,0),(0,1),…,(m,n)] / MaxWeights')*127.

[0178] S903: Determine an integer value corresponding to the third product as a second quantization parameter corresponding to the second target parameter.

[0179] When the second target parameter is the first original activation value, the second quantization parameter is the first quantized activation value; when the second target parameter is the second original weight, the second quantization parameter is the second quantized weight.

[0180] In a specific implementation, the third product may be rounded to obtain a corresponding integer value, which is used as the second quantization parameter corresponding to the second target parameter.

[0181] When the second target parameter is the first original activation value, the corresponding second quantization parameter Qi is:

[0182] Qi=round[(Input'[0,1,...,n] / MaxInput')*127].

[0183] When the second target parameter is the second original weight, the corresponding second quantization parameter Qw is:

[0184] Qw=round[(weights'[(0,0),(0,1),...,(m,n)] / MaxWeights')*127].

[0185] Based on the manner of quantizing the first original activation value or the second original weight, in the above S204, the manner of dequantizing the result of the forward calculation according to the quantization manner of the first original activation value to obtain the output result of the target layer includes:

[0186] The scaling factor S corresponding to the first quantized activation value i , S i =MaxInput' / 127, through the S i The product of the result of the forward calculation is used as the output result of the first target layer.

[0187] If the second original weight is also quantized, the method of performing inverse quantization on the result of the forward calculation according to the quantization method of the first original activation value and the second original weight in S803 to obtain the output result of the target layer includes:

[0188] The scaling factor S corresponding to the quantized weight is also w , S w =MaxWeights' / 127, through the S w The product of the result of the forward calculation is used as the output result of the first target layer.

[0189] The following example explains the calculation process of quantization and dequantization (the first original activation value and the second original weight method are the same):

[0190] Assuming that the weight floating-point parameter, i.e., the second original weight, is [-0.127, 0.126, 0.08, -0.07], the maximum absolute value is 0.127. To convert the floating-point number to the 8-bit symmetric range [-127, 127], the corresponding scaling factor of the second quantized weight is 0.001. The quantized 8-bit fixed-point input, i.e., the second quantized weights, are [-127, 126, 8, 7] respectively.

[0191] Assume that the first quantized activation value is Qi[0,1,…,n] and the second quantized weight is Qw[(0,0),(0,1),…,(m,n)]. The process of forward calculation using the first quantized activation value and the second quantized weight includes:

[0192] Q out =Qi[0,1,…,n]*Qw[(0,0),(0,1),…,(m,n)];

[0193] Q out,0 =Qi0*Qw 0,0 +Qi1*Qw 0,1 +Qi2*Qw 0,2 +…+Qi n *Qw 0,n ;

[0194] Q out,1 =Qi0*Qw 1,0 +Qi1*Qw 1,1 +Qi2*Qw 1,2 +…+Qi n *Qw 1,n ;

[0195] ...;

[0196] Q out,m =Qi0*Qw m,0 +Qi1*Qw m,1 +Qi2*Qw m,2 +…+Qi n *Qw m,n ;

[0197] Q out =[Q out,0 ,Q out,1 ,Q out,2 ,…,Q out,m ];

[0198] R out= Q out *Si *S w .

[0199] Among them, Q out is a string of output results after quantization calculation, that is, the results without scaling, R out Represents mapping the quantized value back to the real floating-point output, which is the output of the scaled first target layer.

[0200] Next, taking the RNN model for speech noise reduction as an example, the data processing method provided in the embodiment of the present application is introduced.

[0201] See also Figure 4 , which shows a flow chart of a hybrid quantization training method provided by an embodiment of the present application, such as Figure 4 As shown in the figure, the data shown in the figure are all floating point types. Among them, the second original activation value can be the input data of the audio (Input), and the first original weight is the weight corresponding to the linear stacking layer (Linear fully connected layer).

[0202] Among them, the second original activation value can be pseudo-quantized by the above method to obtain the corresponding second quantized activation value, and the second quantized activation value can be passed to the operation (i.e., the Linear fully connected layer) for operation. In addition, the first original weight can be pseudo-quantized by the above method to obtain the corresponding first quantized weight, and the first quantized weight can be passed to the operation (i.e., the Linear fully connected layer) for operation. After the first quantized weight and the second quantized activation value are operated in the operation, the operation result can be biased (Bias) to obtain the output result (Output) of the Linear fully connected layer, and the output data, i.e., the second original activation value, can be pseudo-quantized and used as the second quantized activation value of the input to the next layer.

[0203] See also Figure 5 , which shows a flow chart of a dynamic quantitative reasoning method provided by an embodiment of the present application, such as Figure 5 As shown, the above method can be used to determine the second target maximum value of the second original weight absolute value, quantize the weight obtained by model training, i.e., the second initial weight, into 8-bit integer data, i.e., the second quantized weight, and determine the scaling coefficient corresponding to the second quantized weight. The above method can also be used to determine the maximum value of the absolute value of the first original activation value, quantize the first original activation value into 8-bit integer data, i.e., the first quantized activation value, and determine the scaling coefficient corresponding to the first quantized activation value. Then, the first quantized activation value and the second quantized weight are input into the first target layer for quantization calculation, and the quantization result is dequantized by the scaling coefficient corresponding to the second quantized weight and the scaling coefficient corresponding to the first quantized activation value to obtain the final output data, i.e., a floating-point number.

[0204] The technical effect of this application is primarily reflected in the computational efficiency of the neural network forward library. Table 1 below shows the computation time of running an RNN network using convolution methods based on related techniques and using the method of this application on different CPUs. Table 2 shows the difference in accuracy. It can be seen that the method of this application significantly reduces the computation time and achieves the same accuracy as floating-point calculations.

[0205] Table 1 Time consumption of running RNN model in related technologies and this application (single thread)

[0206]

[0207]

[0208] Table 2 Comparison of RNN accuracy between related technologies and this application

[0209] SNR LSD PESQ Related technologies 12.157 1.267 2.809 This application 12.28 1.258 2.764

[0210] See also Figure 6 , which shows a comparison diagram of the effects provided by the embodiment of the present application, such as Figure 6 As shown, which is represented as an audio spectrum, it can be seen that the audio noise after processing in the present application is much better than the effect of the prior art.

[0211] Based on the data processing method provided above, the present application embodiment also provides a data processing device, see Figure 7 , which shows a structural diagram of a data processing device provided by an embodiment of the present application, such as Figure 7 As shown, the device includes:

[0212] An acquiring unit 701 is configured to acquire a first original activation value of a first target layer after inputting the input parameters into the model, where the first target layer is any layer in the model;

[0213] a quantization unit 702 configured to quantize the first original activation value to determine a corresponding first quantized activation value; wherein the first quantized activation value is within an integer value range;

[0214] A calculation unit 703 is configured to perform forward calculation according to the first quantized activation value and the weight of the first target layer;

[0215] a dequantization unit 704 configured to dequantize the result of the forward calculation according to the quantization method of the first original activation value to obtain an output result of the first target layer;

[0216] The determination unit 705 is configured to determine data corresponding to the input parameters after the calculation of the input parameters is completed using the model.

[0217] In a possible implementation, the determining unit 705 is specifically configured to:

[0218] During the i-th training of the initial model using the training sample, obtaining a second original activation value of a second target layer, where the second target layer is any layer in the initial model;

[0219] quantizing the second original activation value according to a first numerical range of the second original activation value to determine a corresponding second quantized activation value; wherein the second quantized activation value is within the first numerical range;

[0220] Perform forward calculation based on the second quantized activation value and the weight of the second target layer;

[0221] After completing the training for the initial model, the weight of the initial model is determined as the target weight of the model.

[0222] In a possible implementation, the determining unit 705 is further configured to:

[0223] quantizing the first original weight of the second target layer according to a second numerical range of the first original weight to determine a corresponding first quantized weight; wherein the first quantized weight is within the second numerical range;

[0224] The performing forward calculation according to the second quantized activation value and the weight of the second target layer includes: performing forward calculation according to the second quantized activation value and the first quantized weight.

[0225] In a possible implementation, the determining unit 705 is further configured to:

[0226] The second original activation value or the first original weight as the first target parameter, determining a first target numerical range of the first target parameter according to a first target maximum value of the absolute value corresponding to the first target parameter;

[0227] Determining a first target number of first quantized values ​​that conform to the first target value range;

[0228] According to the first target parameter and the first target number of first quantization values, determine the corresponding first quantization value as the first quantization parameter corresponding to the first target parameter; when the first target parameter is the second original activation value, the first quantization parameter is the second quantization activation value; when the first target parameter is the first original weight, the quantization parameter is the first quantization weight.

[0229] In a possible implementation, the determining unit 705 is further configured to:

[0230] Determine a first target maximum value of an absolute value corresponding to the first target parameter using the second original activation value or the first original weight as a first target parameter;

[0231] Determine a first product of a first numerical value corresponding to the first target parameter and a first integer characteristic number, where the first numerical value is a quotient of the first target parameter and the first target maximum value;

[0232] Determining an integer value corresponding to the first product, and determining a second product of the integer value and a second value, where the second value is a quotient of the first target maximum value and the first integer characteristic number;

[0233] Determine that the second product is the first quantization parameter corresponding to the first target parameter, when the first target parameter is the second original activation value, the first quantization parameter is the second quantized activation value, when the first target parameter is the first original weight, the first quantization parameter is the first quantization weight.

[0234] In a possible implementation, the determining unit 705 is further configured to:

[0235] When the first target parameter is the first original weight, determining a first target maximum value of the absolute value corresponding to the first target parameter includes:

[0236] According to the maximum absolute value corresponding to the first original weight and the maximum absolute value corresponding to the first original weight of the second target layer during the i-1th training process, the first target maximum absolute value corresponding to the first original weight is determined.

[0237] In a possible implementation, the quantization unit 702 is further configured to:

[0238] quantizing a second original weight of the first target layer to determine a corresponding second quantized weight, wherein the second quantized weight is within an integer value range;

[0239] The calculation unit 703 is specifically configured to:

[0240] Perform forward calculation based on the first quantized activation value and the second quantized weight;

[0241] The dequantization unit 704 is specifically configured to:

[0242] Dequantize the result of the forward calculation according to the quantization method of the first original activation value and the second original weight.

[0243] In a possible implementation, the quantization unit 702 is further configured to:

[0244] Determining a second target maximum value of an absolute value corresponding to the second target parameter using the first original activation value or the second original weight as a second target parameter;

[0245] Determine a third product of a third value corresponding to the second target parameter and the second integer characteristic number, wherein the third value is a quotient of the second target parameter and the second target maximum value;

[0246] Determine an integer value corresponding to the third product as a second quantization parameter corresponding to the second target parameter, when the second target parameter is the first original activation value, the second quantization parameter is the first quantized activation value, when the second target parameter is the second original weight, the second quantization parameter is the second quantization weight.

[0247] As can be seen from the above technical solution, after inputting input parameters requiring data processing into the model, the first raw activation value of the first target layer (any layer in the model) can be obtained. The first raw activation value is quantized to determine a corresponding first quantized activation value, which is within an integer range. In other words, the first raw activation value is quantized to an integer. In this manner, a forward calculation is performed based on the quantized first quantized activation value and the weight of the first target layer. After the forward calculation of the first quantized activation value is completed by the first target layer, the result of the forward calculation is dequantized based on the quantization method used for the first raw activation value to obtain the output result of the first target layer. This ensures that the difference between the output result and the result obtained by forward calculation using the first raw activation value is within an acceptable range. After the model completes the calculation of the input parameters, the data corresponding to the input parameters is determined. In this method, by quantizing the first raw activation value of the first target layer to an integer value with fewer bits, data processing bandwidth pressure is reduced and the computing power of the data processing equipment is improved, while minimizing the impact on the data processing results.

[0248] The present application also provides a data processing device, which is described below with reference to the accompanying drawings. Figure 8 As shown, an embodiment of the present application provides a structural diagram of a data processing device 900. The device 900 may also be a terminal device. For example, the terminal device is a mobile phone:

[0249] Figure 8 The figure shows a partial structural block diagram of the mobile phone provided in the embodiment of the present application. Figure 8The mobile phone includes components such as a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, a processor 980, and a power supply 990. It will be understood by those skilled in the art that Figure 8 The mobile phone structure shown in the figure does not constitute a limitation to the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0250] The following combination Figure 8 A detailed introduction to the various components of a mobile phone:

[0251] The RF circuit 910 can be used to receive and send signals during information transmission or calls. In particular, after receiving downlink information from the base station, it is sent to the processor 980 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 910 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 910 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0252] The memory 920 can be used to store software programs and modules. The processor 980 executes the various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 920. The memory 920 may mainly include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created based on the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory 920 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0253] The input unit 930 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 930 may include a touch panel 931 and other input devices 932. The touch panel 931, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel 931) and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 931 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 980, and can receive commands sent by the processor 980 and execute them. In addition, the touch panel 931 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 931, the input unit 930 may further include other input devices 932. Specifically, the other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick.

[0254] The display unit 940 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 940 may include a display panel 941. Optionally, the display panel 941 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 931 may cover the display panel 941. When the touch panel 931 detects a touch operation on or near it, it is transmitted to the processor 980 to determine the type of touch event. Subsequently, the processor 980 provides corresponding visual output on the display panel 941 according to the type of touch event. Although in Figure 8 In the embodiment, the touch panel 931 and the display panel 941 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 931 and the display panel 941 can be integrated to realize the input and output functions of the mobile phone.

[0255] The mobile phone may also include at least one sensor 950, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 941 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that the mobile phone can also be configured with, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.

[0256] Audio circuit 960, speaker 961, and microphone 962 provide an audio interface between the user and the phone. Audio circuit 960 converts received audio data into electrical signals and transmits them to speaker 961, which then converts them into sound signals for output. Microphone 962, on the other hand, converts collected sound signals into electrical signals, which are then received by audio circuit 960 and converted into audio data. The audio data is then processed by processor 980 and transmitted to, for example, another phone via RF circuit 910, or stored in memory 920 for further processing.

[0257] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse the web and access streaming media through the WiFi module 970. It provides users with wireless broadband Internet access. Figure 8A WiFi module 970 is shown, but it is understandable that it is not an essential component of the mobile phone and can be omitted as needed without changing the essence of the invention.

[0258] The processor 980 is the control center of the mobile phone. It connects all parts of the mobile phone using various interfaces and circuits. It executes the software programs and / or modules stored in the memory 920 and accesses data stored in the memory 920 to perform various functions of the mobile phone and process data. Optionally, the processor 980 may include one or more processing units. Preferably, the processor 980 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor does not need to be integrated into the processor 980.

[0259] The mobile phone also includes a power supply 990 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 980 through a power management system, thereby managing charging, discharging, and power consumption management functions through the power management system.

[0260] Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0261] In this embodiment, the processor 980 included in the terminal device further has the following functions:

[0262] After inputting the input parameters into the model, obtaining a first original activation value of a first target layer, where the first target layer is any layer in the model;

[0263] quantizing the first original activation value to determine a corresponding first quantized activation value, wherein the first quantized activation value is within an integer value range;

[0264] Perform forward calculation based on the first quantized activation value and the weight of the first target layer;

[0265] Dequantize the result of the forward calculation according to the quantization method of the first original activation value to obtain an output result of the first target layer;

[0266] After the calculation of the input parameters is completed by the model, data corresponding to the input parameters are determined.

[0267] The data processing device provided in the embodiment of the present application may be a server, see Figure 9 As shown, Figure 9The structural diagram of the server 1000 provided in the embodiment of the present application, the server 1000 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPUs) 1022 (for example, one or more processors) and a memory 1032, and one or more storage media 1030 (for example, one or more massive storage devices) for storing application programs 1042 or data 1044. Among them, the memory 1032 and the storage medium 1030 can be temporary storage or persistent storage. The program stored in the storage medium 1030 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 1022 can be configured to communicate with the storage medium 1030 to execute a series of instruction operations in the storage medium 1030 on the server 1000.

[0268] The server 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input and output interfaces 1058, and / or one or more operating systems 1041, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0269] The steps in the above embodiment can also be performed by a server, which can be based on the Figure 9 The server structure shown.

[0270] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the methods described in the above embodiments.

[0271] An embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.

[0272] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0273] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0274] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0275] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0276] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0277] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application 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 storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.

[0278] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

[0279] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the above-mentioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the above-mentioned storage medium can be at least one of the following media: read-only memory (English: read-only memory, abbreviated: ROM), RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0280] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0281] The above is merely one specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A data processing method, characterized in that: The method comprises: After inputting the input parameters into the model, obtaining a first original activation value of a first target layer, where the first target layer is any layer in the model; quantizing the first original activation value to determine a corresponding first quantized activation value, wherein the first quantized activation value is within an integer value range; Perform forward calculation based on the first quantized activation value and the weight of the first target layer; Dequantize the result of the forward calculation according to the quantization method of the first original activation value to obtain an output result of the first target layer; After completing the calculation for the input parameters by the model, determining data corresponding to the input parameters, the data including data for completing the speech analysis; The model is trained as follows: During the i-th training of the initial model using the training sample, obtaining a second original activation value of a second target layer, where the second target layer is any layer in the initial model; Dynamically quantizing the second original activation value according to a first numerical range of the second original activation value to determine a corresponding second quantized activation value; wherein the second quantized activation value is within the first numerical range; Perform forward calculation based on the second quantized activation value and the weight of the second target layer; After completing the training for the initial model, the weight of the initial model is determined as the target weight of the model.

2. The method according to claim 1, characterized in that The method further comprises: quantizing the first original weight of the second target layer according to a second numerical range of the first original weight to determine a corresponding first quantized weight; wherein the first quantized weight is within the second numerical range; The performing forward calculation according to the second quantized activation value and the weight of the second target layer includes: performing forward calculation according to the second quantized activation value and the first quantized weight.

3. The method according to claim 2, characterized in that The second original activation value or the first original weight is used as the first target parameter, and the first target parameter is quantized to determine the corresponding first quantization parameter in the following manner: determining a first target numerical range of the first target parameter according to a first target maximum value of the absolute value corresponding to the first target parameter; Determining a first target number of first quantized values ​​that conform to the first target value range; According to the first target parameter and the first target number of first quantization values, determine the corresponding first quantization value as the first quantization parameter corresponding to the first target parameter; when the first target parameter is the second original activation value, the first quantization parameter is the second quantization activation value; when the first target parameter is the first original weight, the quantization parameter is the first quantization weight.

4. The method according to claim 2, characterized in that The second original activation value or the first original weight is used as the first target parameter, and the first target parameter is quantized to determine the corresponding first quantization parameter in the following manner: determining a first target maximum value of the absolute value corresponding to the first target parameter; Determine a first product of a first numerical value corresponding to the first target parameter and a first integer characteristic number, where the first numerical value is a quotient of the first target parameter and the first target maximum value; Determining an integer value corresponding to the first product, and determining a second product of the integer value and a second value, where the second value is a quotient of the first target maximum value and the first integer characteristic number; Determine that the second product is the first quantization parameter corresponding to the first target parameter, when the first target parameter is the second original activation value, the first quantization parameter is the second quantized activation value, when the first target parameter is the first original weight, the first quantization parameter is the first quantization weight.

5. The method according to claim 3 or 4, characterized in that When the first target parameter is the first original weight, determining a first target maximum value of the absolute value corresponding to the first target parameter includes: According to the maximum absolute value corresponding to the first original weight and the maximum absolute value corresponding to the first original weight of the second target layer during the i-1th training process, the first target maximum absolute value corresponding to the first original weight is determined.

6. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: quantizing a second original weight of the first target layer to determine a corresponding second quantized weight, wherein the second quantized weight is within an integer value range; The performing forward calculation according to the first quantized activation value and the weight of the first target layer includes: Perform forward calculation based on the first quantized activation value and the second quantized weight; The dequantizing the result of the forward calculation according to the quantization method of the first original activation value includes: Dequantize the result of the forward calculation according to the quantization method of the first original activation value and the second original weight.

7. A data processing device, characterized in that: The device comprises: an acquiring unit, configured to acquire a first original activation value of a first target layer after inputting the input parameters into the model, where the first target layer is any layer in the model; a quantization unit, configured to quantize the first original activation value to determine a corresponding first quantized activation value, wherein the first quantized activation value is within an integer value range; a computing unit, configured to perform forward computation based on the first quantized activation value and the weight of the first target layer; a dequantization unit, configured to dequantize the result of the forward calculation according to the quantization method of the first original activation value to obtain an output result of the first target layer; a determination unit, configured to determine data corresponding to the input parameters after completing calculation for the input parameters by the model, the data including data for completing speech analysis; The determining unit is specifically configured to: During the i-th training of the initial model using the training sample, obtaining a second original activation value of a second target layer, where the second target layer is any layer in the initial model; Dynamically quantizing the second original activation value according to a first numerical range of the second original activation value to determine a corresponding second quantized activation value; wherein the second quantized activation value is within the first numerical range; Perform forward calculation based on the second quantized activation value and the weight of the second target layer; After completing the training for the initial model, the weight of the initial model is determined as the target weight of the model.

8. The device according to claim 7, characterized in that The determining unit is further specifically configured to: quantizing the first original weight of the second target layer according to a second numerical range of the first original weight to determine a corresponding first quantized weight; wherein the first quantized weight is within the second numerical range; The performing forward calculation according to the second quantized activation value and the weight of the second target layer includes: performing forward calculation according to the second quantized activation value and the first quantized weight.

9. The device according to claim 8, characterized in that The determining unit is further specifically configured to: determining a first target numerical range of the first target parameter according to a first target maximum value of the absolute value corresponding to the first target parameter; Determining a first target number of first quantized values ​​that conform to the first target value range; According to the first target parameter and the first target number of first quantization values, determine the corresponding first quantization value as the first quantization parameter corresponding to the first target parameter; when the first target parameter is the second original activation value, the first quantization parameter is the second quantization activation value; when the first target parameter is the first original weight, the quantization parameter is the first quantization weight.

10. The device according to claim 8, characterized in that The determining unit is further specifically configured to: determining a first target maximum value of the absolute value corresponding to the first target parameter; Determine a first product of a first numerical value corresponding to the first target parameter and a first integer characteristic number, where the first numerical value is a quotient of the first target parameter and the first target maximum value; Determining an integer value corresponding to the first product, and determining a second product of the integer value and a second value, where the second value is a quotient of the first target maximum value and the first integer characteristic number; Determine that the second product is the first quantization parameter corresponding to the first target parameter, when the first target parameter is the second original activation value, the first quantization parameter is the second quantized activation value, when the first target parameter is the first original weight, the first quantization parameter is the first quantization weight.

11. The device according to claim 9 or 10, characterized in that The determining unit is further specifically configured to: When the first target parameter is the first original weight, determining a first target maximum value of the absolute value corresponding to the first target parameter includes: According to the maximum absolute value corresponding to the first original weight and the maximum absolute value corresponding to the first original weight of the second target layer during the i-1th training process, the first target maximum absolute value corresponding to the first original weight is determined.

12. The device according to any one of claims 8 to 10, characterized in that The quantization unit is further specifically configured to: quantizing a second original weight of the first target layer to determine a corresponding second quantized weight, wherein the second quantized weight is within an integer value range; The computing unit is specifically configured to: Perform forward calculation based on the first quantized activation value and the second quantized weight; The dequantization unit is specifically used for: Dequantize the result of the forward calculation according to the quantization method of the first original activation value and the second original weight.

13. A device, characterized in that The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method according to any one of claims 1 to 6 according to instructions in the program code.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 6.

15. A computer program product, characterized in that The computer program product comprises instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Target identification method and device

    CN110008952A

  • Neural network model construction method, device and equipment, and storage medium

    CN110334802A