Method, apparatus and computer readable storage medium for accelerating neural network computation
By identifying valid data in the neural network model and performing distributed computation, the problem of low efficiency in sparse neural network computation is solved, achieving a more efficient computation method and reducing the generation of empty cycles.
Patent Information
- Application Number
- CN202210205189.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-02
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2042-03-02
AI Technical Summary
In existing technologies, the computational efficiency of sparse neural networks has not been improved. Although data redundancy pruning can compress the model size, the computation time has not been shortened, and there are a large number of idle computation cycles.
By identifying valid data in the neural network model, computation is performed only when valid data is available, and valid data is computed in a distributed manner across multiple sets of data, thus reducing empty cycles.
It significantly reduces the number of empty cycles and improves the efficiency of neural network computation, especially when the model is over-datafied.
Smart Images

Figure CN114722997B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, and computer-readable storage medium for accelerating neural network computation. Background Technology
[0002] Because neural network models are over-parameterized, much of the data is redundant, and properly deleting this data has almost no impact on the final model result. Model pruning is a good example. Pruning can compress the model size by more than 10 times, which means reducing the model's computation by more than 10 times. Combined with the increased computing power of customized hardware, this could ultimately lead to even greater performance improvements. However, even if only 10% of the data needs to be computed, if the acquired data is invalid, idle computation cycles will occur even though no computation is performed. Therefore, the actual computation time is not shortened. This demonstrates that the computational efficiency of sparse convolutional neural networks is not improved. Summary of the Invention
[0003] The present invention provides a method, apparatus, and computer-readable storage medium for accelerating neural network computation, aiming to solve the technical problem of how to improve the efficiency of sparse neural network computation.
[0004] This invention provides a method for accelerating neural network computation, the method comprising:
[0005] Multiple sets of data are obtained from a neural network model. Each set of data has a corresponding data identifier, which includes valid data identifiers and invalid data identifiers. The data includes feature images and neural network parameter values corresponding to the feature images.
[0006] Based on the data identifier, determine whether there is valid data among the multiple sets of data;
[0007] If valid data exists in multiple sets of data, neural network calculations are performed based on the valid data to obtain the calculation result.
[0008] In one embodiment, after the step of determining whether valid data exists among the multiple sets of data based on the data identifier, the method further includes:
[0009] If no valid data is found in any of the multiple sets of data, return to the step of obtaining multiple sets of data.
[0010] In one embodiment, the step of performing neural network calculations based on the valid data to obtain the calculation result if valid data exists in multiple sets of data includes:
[0011] If valid data exists in multiple sets of data, determine the number of sets of valid data.
[0012] When the number of valid data sets is greater than 1, the valid data is computed in a distributed manner to obtain the computation result.
[0013] In one embodiment, the step of performing neural network calculations based on the valid data to obtain the calculation result if valid data exists in multiple sets of data includes:
[0014] If valid data exists in multiple sets of data, determine the number of sets of valid data.
[0015] When the number of valid data sets is greater than 1, the valid data sets are calculated sequentially to obtain the calculation result.
[0016] In one embodiment, prior to the step of acquiring multiple sets of data from the neural network model, the method further includes:
[0017] Determine the data values in the neural network model;
[0018] The data in the neural network model is labeled according to the data values so that multiple sets of data correspond to data identifiers.
[0019] In one embodiment, the step of labeling the data in the neural network model based on the data values includes:
[0020] Determine whether the data value is within the valid data range;
[0021] If the data value is within the valid data range, the data corresponding to the data value is marked as valid data.
[0022] If the data value is not within the valid data range, the data corresponding to the data value is marked as invalid data.
[0023] In one embodiment, the step of performing neural network calculations based on the valid data to obtain the calculation result if valid data exists in multiple sets of data includes:
[0024] If valid data exists in multiple sets of data, the valid data is obtained and subjected to convolution, pooling, and classification to obtain the calculation result.
[0025] In one embodiment, after the step of performing neural network calculations based on the valid data to obtain the calculation result if valid data exists in multiple sets of data, the method further includes:
[0026] Output the calculation results.
[0027] This invention also provides an acceleration device for neural network computing, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps of the neural network computing acceleration method described above.
[0028] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the various steps of the neural network computation acceleration method described above.
[0029] In this embodiment, the neural network computation acceleration device acquires multiple sets of data from a neural network model. Each set of data has a corresponding data identifier, including valid and invalid data identifiers. The data includes feature images and corresponding neural network parameter values. The device determines whether valid data exists in the multiple sets of data based on the data identifiers. If valid data exists, neural network computation is performed based on the valid data to obtain the computation result. Since model pruning techniques acquire only one set of data per computation cycle, invalid data results in empty cycles for computation. Given that neural network models are over-datafied, existing techniques generate a large number of empty cycles. However, the neural network computation acceleration device of this invention acquires multiple sets of data in one computation cycle. Therefore, empty cycles only occur when all acquired data are invalid. Compared to model pruning, this invention significantly reduces the number of empty cycles and improves the efficiency of neural network computation. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0031] Figure 1 This is a schematic diagram of the hardware architecture of the neural network computing acceleration device according to an embodiment of the present invention;
[0032] Figure 2 This is a flowchart illustrating the first embodiment of the neural network computation acceleration method of the present invention;
[0033] Figure 3 This is a first reference figure for the method of accelerating neural network computation according to the present invention;
[0034] Figure 4 This is a second reference figure for the method of accelerating neural network computation according to the present invention;
[0035] Figure 5 This is a detailed flowchart of step S30 in the second embodiment of the neural network computation acceleration method of the present invention;
[0036] Figure 6 This is a detailed flowchart of step S30 in the third embodiment of the neural network computation acceleration method of the present invention;
[0037] Figure 7 This is a flowchart illustrating the fourth embodiment of the neural network computation acceleration method of the present invention;
[0038] Figure 8 This is a third reference figure for the accelerated neural network computation method of the present invention. Detailed Implementation
[0039] To better understand the above technical solutions, exemplary embodiments of this disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of this disclosure to those skilled in the art.
[0040] The main solution of this invention is as follows: A neural network computation acceleration device acquires multiple sets of data from a neural network model. Each set of data has a corresponding data identifier, which includes valid data identifiers and invalid data identifiers. The data includes feature images and neural network parameter values corresponding to the feature images. Based on the data identifiers, it is determined whether there is valid data among the multiple sets of data. If there is valid data among the multiple sets of data, neural network computation is performed based on the valid data to obtain the computation result.
[0041] Because model pruning techniques acquire only one set of data per computation cycle, if the acquired data is invalid, an empty cycle will be generated for computation. Since neural network models are all over-data-driven, existing techniques generate a large number of empty cycles. However, the neural network computation acceleration device of this invention acquires multiple sets of data in one computation cycle. Therefore, an empty cycle will only be generated when all acquired data is invalid. Compared with model pruning, the inventors can significantly reduce the number of empty cycles generated and improve the efficiency of neural network computation.
[0042] As one implementation method, acceleration devices for neural network computation can be such as Figure 1 .
[0043] The embodiments of the present invention relate to an acceleration device for neural network computing, which includes: a processor 101, such as a CPU, a memory 102, and a communication bus 103. The communication bus 103 is used to enable communication between these components.
[0044] Memory 102 can be high-speed RAM or stable memory (non-volatile memory), such as disk storage. Figure 1 The memory 103, which is a computer-readable storage medium, may include a detection program; and the processor 101 may be used to call the detection program stored in the memory 102 and perform the following operations:
[0045] Multiple sets of data are obtained from a neural network model. Each set of data has a corresponding data identifier, which includes valid data identifiers and invalid data identifiers. The data includes feature images and neural network parameter values corresponding to the feature images.
[0046] Based on the data identifier, determine whether there is valid data among the multiple sets of data;
[0047] If valid data exists in multiple sets of data, neural network calculations are performed based on the valid data to obtain the calculation result.
[0048] In one embodiment, the processor 101 can be used to invoke a detection program stored in the memory 102 and perform the following operations:
[0049] If no valid data is found in any of the multiple sets of data, return to the step of obtaining multiple sets of data.
[0050] In one embodiment, the processor 101 can be used to invoke a detection program stored in the memory 102 and perform the following operations:
[0051] If valid data exists in multiple sets of data, determine the number of sets of valid data.
[0052] When the number of valid data sets is greater than 1, the valid data is computed in a distributed manner to obtain the computation result.
[0053] In one embodiment, the processor 101 can be used to invoke a detection program stored in the memory 102 and perform the following operations:
[0054] If valid data exists in multiple sets of data, determine the number of sets of valid data.
[0055] When the number of valid data sets is greater than 1, the valid data sets are calculated sequentially to obtain the calculation result.
[0056] In one embodiment, the processor 101 can be used to invoke a detection program stored in the memory 102 and perform the following operations:
[0057] Based on the data in the neural network model, perform neural network calculations to obtain reference calculation results;
[0058] The data in the neural network model is labeled according to the data values so that multiple sets of data correspond to data identifiers.
[0059] In one embodiment, the processor 101 can be used to invoke a detection program stored in the memory 102 and perform the following operations:
[0060] Determine whether the data value is within the valid data range;
[0061] If the data value is within the valid data range, the data corresponding to the data value is marked as valid data.
[0062] If the data value is not within the valid data range, the data corresponding to the data value is marked as invalid data.
[0063] In one embodiment, the processor 101 can be used to invoke a detection program stored in the memory 102 and perform the following operations:
[0064] If valid data exists in multiple sets of data, the valid data is obtained and subjected to convolution, pooling, and classification to obtain the calculation result.
[0065] In one embodiment, the processor 101 can be used to invoke a detection program stored in the memory 102 and perform the following operations:
[0066] Output the calculation results.
[0067] In this embodiment, the neural network computation acceleration device acquires multiple sets of data from a neural network model. Each set of data has a corresponding data identifier, including valid and invalid data identifiers. The data includes feature images and corresponding neural network parameter values. The device determines whether valid data exists in the multiple sets of data based on the data identifiers. If valid data exists, neural network computation is performed based on the valid data to obtain the computation result. Since model pruning techniques acquire only one set of data per computation cycle, invalid data results in empty cycles for computation. Given that neural network models are over-datafied, existing techniques generate a large number of empty cycles. However, the neural network computation acceleration device of this invention acquires multiple sets of data in one computation cycle. Therefore, empty cycles only occur when all acquired data are invalid. Compared to model pruning, this invention significantly reduces the number of empty cycles and improves the efficiency of neural network computation.
[0068] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.
[0069] Reference Figure 2 , Figure 2 This is a first embodiment of the method for accelerating neural network computation according to the present invention. The method includes the following steps:
[0070] Step S10: Obtain multiple sets of data from the neural network model. Each set of data has a corresponding data identifier, which includes valid data identifiers and invalid data identifiers. The data includes feature images and neural network parameter values corresponding to the feature images.
[0071] The success of artificial intelligence in fields such as image processing and speech recognition is largely attributed to large, multi-layered deep neural network models. To achieve even better results or solve more complex problems, these models are becoming increasingly larger and more complex. However, in most applications of AI, such as machine translation, speech recognition, and autonomous driving, users are extremely sensitive to the responsiveness of AI systems, sometimes even to matters of life and death. Therefore, low-latency inference of deep neural networks is a critical issue for the practical application of AI.
[0072] The sparsity of the input to the convolutional layer of a neural network model stems from several factors. First, the input to the first convolutional layer is the original image, in which many pixels may be zero. Images are typically 8-bit, representing 256 colors (0-255). A simple analogy is a single-channel 8-bit color image with three channels: r, g, and b. For example, the RGB value of a pixel in a color image might be (234, 103, 67). Here, 255 represents pure white, and 0 represents pure black. In extreme cases, if the entire image is black, all pixels would be zero, while in general, images will contain many zero values. Second, the application of activation functions introduces significant sparsity. Activation functions are used to introduce non-linearity, addressing problems that linear models cannot solve. Activation functions originated in biology. Neurobiology holds that a neuron is either in an activated or inhibited state. One of the goals of artificial neural networks is to simulate this mechanism, so a binary activation process was designed according to this principle. That is, if the value exceeds a certain threshold, it takes the value 1, representing activation, and if the value is below a certain threshold, it takes the value 0, representing inhibition.
[0073] Typical AI chip designs utilize multiple dedicated storage units (such as on-chip RAM) to cache various data generated during the execution of neural network algorithms. This ensures the AI chip can quickly and efficiently complete neural network calculations, reducing latency caused by data transmission. The traditional approach involves allocating a separate storage space for each of the commonly used, large-volume data types in the neural network, retrieving the data from the corresponding storage space for computation. For example… Figure 3 As shown, storage unit A stores the feature image, and storage unit B stores the neural network parameter values. Furthermore, after the feature image and its corresponding neural network parameter values are sequentially input into computation modules A, B, and C, the final calculation result is stored again in storage unit A. Computation modules A, B, and C can perform computational steps such as convolution and pooling.
[0074] In neural networks, many feature images and data values are zero or close to zero. Because these values have little impact on the final calculation result, they can be ignored. Furthermore, due to the irregular distribution of these data, it is usually difficult to remove them one by one.
[0075] Step S20: Determine whether there is valid data among the multiple sets of data based on the data identifier.
[0076] In this embodiment, a method for accelerating neural network computation is provided for sparse neural network models. This method can eliminate irregularly distributed data that has little impact on the computation results, thereby reducing computation time and saving more power consumption.
[0077] Optionally, the data values in the neural network model are determined; the data in the neural network model are labeled according to the data values so that multiple sets of data correspond to data identifiers.
[0078] Optionally, determine whether the data value is within the valid data range; if the data value is within the valid data range, mark the data corresponding to the data value as valid data; if the data value is not within the valid data range, mark the data corresponding to the data value as invalid data.
[0079] Specifically, for data labeling, refer to Figure 4 This embodiment adds two modules, Bit-map A and Bit-map B, corresponding to storage unit A and storage unit B respectively. Assuming storage unit A and storage unit B can store M and N data points respectively, then the sizes of Bit-map A and Bit-map B are M bits and N bits respectively. Each bit in Bit-map A is used to identify whether each data point in storage unit A needs to participate in the calculation. For example, if storage unit A stores 256 16-bit integer data points, then Bit-map A stores 256 bits, each bit corresponding to a data point in storage unit A. When the value of a bit in Bit-map A is 1 (valid data identifier), it means that the data at that corresponding position in storage unit A is valid and needs to participate in the calculation; when the value of a bit in Bit-map A is 0 (invalid data identifier), it means that the data at that corresponding position in storage unit A is invalid and does not need to participate in the calculation.
[0080] Typically, each storage unit has only one data fetching unit, used to read the data that needs to be used in the next calculation. However, in the new architecture, since the next data read might be invalid, no calculation is needed. If calculation is simply not started in this case, an idle calculation cycle will be generated, which does not effectively save calculation time. Therefore, the new architecture adds a data prefetching module, which can read data from multiple bitmaps at once, determine the position of the next valid data based on the read bitmap data, and then read the valid data from the data storage unit and send it to the subsequent calculation module to start the calculation. If all the bitmap data read in a prefetch is invalid, then calculation is not started, generating an idle calculation cycle.
[0081] So how is the data in the Bit-map generated? Before the feature image data is stored in storage unit A, it is first determined whether the data will affect the calculation result (specifically, this could be done by checking if the data is 0 or a value close to 0, or by determining this based on different neural networks). If the data will affect the calculation result, it will be written into the storage unit, and the data will be marked as valid at the corresponding position in the Bit-map. If the data will not affect the calculation result, it will be discarded directly and not written into the storage unit, and the data will be marked as invalid at the corresponding position in the Bit-map.
[0082] Step S30: If valid data exists in multiple sets of data, perform neural network calculations based on the valid data to obtain the calculation results.
[0083] In this embodiment, the location of valid data is obtained, and valid data is read from the storage unit. This data is then sent to the computing unit to initiate neural network computation and obtain the computation result.
[0084] Optionally, if no valid data is found in any of the multiple sets of data, the process returns to the step of obtaining multiple sets of data. In this case, returning to obtain valid data when no valid data is found completes the process loop of the accelerated neural network computation method.
[0085] Optionally, if valid data exists among multiple sets of data, the valid data is acquired and subjected to convolution, pooling, and classification to obtain the calculation result. The specific computational steps of the neural network are not limited, but mainly include data input and calculation result output.
[0086] In the technical solution of this embodiment, since the model pruning technique only acquires one set of data in one calculation cycle, if the acquired data is invalid, an empty cycle will be generated for calculation. Given that neural network models are all over-data-driven, existing techniques will generate a large number of empty cycles. However, the neural network calculation acceleration device of the present invention acquires multiple sets of data in one calculation cycle. Therefore, an empty cycle will only be generated when all acquired data is invalid. Compared with model pruning, the inventors can significantly reduce the number of empty cycles generated and improve the efficiency of neural network calculation.
[0087] Reference Figure 5 , Figure 5 In a second embodiment of the neural network computation acceleration method of the present invention, based on the first embodiment, step S30 includes:
[0088] Step S31: If valid data exists in multiple sets of data, determine the number of sets of valid data.
[0089] Step S32: When the number of valid data sets is greater than 1, the valid data is calculated in a distributed manner to obtain the calculation result.
[0090] In the technical solution of this embodiment, when multiple sets of valid data are determined, the distributed computing module in the neural network computing acceleration device can simultaneously perform neural network computing on multiple sets of data, further improving the efficiency of neural network computing.
[0091] Reference Figure 6 , Figure 6 In a third embodiment of the neural network computation acceleration method of the present invention, based on any one of the first or second embodiments, step S30 includes:
[0092] Step S33: If valid data exists in multiple sets of data, determine the number of sets of valid data.
[0093] Step S34: When the number of valid data sets is greater than 1, calculate the valid data sets sequentially to obtain the calculation results.
[0094] In the technical solution of this embodiment, when multiple sets of valid data are determined, neural network calculations are performed on the multiple sets of data in sequence, which reduces the probability of the calculation module generating empty cycles and improves the utilization rate of computing resources.
[0095] Reference Figure 7 , Figure 7 This is a fourth embodiment of the neural network computation acceleration method of the present invention, based on any one of the first to third embodiments. After step S30, it further includes:
[0096] Step S40: Output the calculation result.
[0097] In this embodiment, reference Figure 8 The process of accelerating neural network computation in this embodiment is as follows:
[0098] Step 1: Before writing data to the storage unit, determine whether the data is valid and whether it needs to be used in the calculation. If it needs to be used in the calculation, proceed to Step 2; otherwise, proceed to Step 3.
[0099] Step 2: Write the valid data into the memory of the neural network computing acceleration device, and at the same time, mark the corresponding position in the Bit-map as valid data.
[0100] Step 3: Discard invalid data and mark the corresponding position in the Bit-map as invalid. Jump back to Step 1 to check the next data.
[0101] Step 4: When starting the calculation, read the data identifiers corresponding to the data to be calculated from the Bit-map.
[0102] Step 5: Determine if there is valid data in the currently retrieved data set. If valid data exists, proceed to Step 6; otherwise, proceed to Step 7.
[0103] Step Six: Locate the valid data and read the valid data from the storage unit. Send it to the computing unit to start the computation.
[0104] Step 7: If no valid data is found in the currently obtained identifiers, do not start the calculation. Then, go back to Step 4 and obtain the next set of data identifiers from the Bit-map.
[0105] Step 8: Output the final calculation results.
[0106] In the technical solution of this embodiment, the output of the final calculation result allows the user to understand it in a timely manner and intuitively demonstrates the acceleration effect of neural network calculation.
[0107] To achieve the above objectives, embodiments of the present invention also provide an acceleration device for neural network computing. The acceleration device for neural network computing includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps of the neural network computing acceleration method described above.
[0108] To achieve the above objectives, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the various steps of the neural network computation acceleration method described above.
[0109] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program embodied on one or more computer-usable, computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0110] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0111] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0112] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0113] It should be noted that any reference signs placed between parentheses in the claims should not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0114] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0115] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for accelerating neural network computation, characterized in that, The method comprises: determining data values of data in a neural network model; data marking the data in the neural network model according to the data values, so that a plurality of groups of the data correspond to data identifiers; reading a plurality of groups of data in the neural network model at a time by a data prefetching module, the data prefetching module reading data in a plurality of Bit-maps at a time, and judging the position of the next valid data according to the read data of the Bit-maps, reading valid data from a data storage unit, the data identifiers including valid data identifiers and invalid data identifiers, and the data including feature images and neural network parameter values corresponding to the feature images; determining whether there is valid data in the plurality of groups of data according to the data identifiers; if there is valid data in the plurality of groups of data, performing neural network calculation according to the valid data to obtain a calculation result, wherein the neural network calculation includes convolution calculation or pooling calculation, the data stored in the data storage unit is data that has an impact on the calculation result, and the neural network model inputs image data.
2. The method of accelerating neural network computation of claim 1, wherein, After the step of determining whether there is valid data in the plurality of groups of data according to the data identifiers, the method further comprises: if there is no valid data in the plurality of groups of data, returning to the step of obtaining a plurality of groups of data.
3. The method of claim 1, wherein, The step of, if there is valid data in the plurality of groups of data, performing neural network calculation according to the valid data to obtain a calculation result, comprises: if there is valid data in the plurality of groups of data, determining the number of groups of the valid data; if the number of groups of the valid data is greater than 1, performing distributed calculation on the valid data to obtain the calculation result.
4. The method of claim 1, wherein, The step of, if there is valid data in the plurality of groups of data, performing neural network calculation according to the valid data to obtain a calculation result, comprises: if there is valid data in the plurality of groups of data, determining the number of groups of the valid data; if the number of groups of the valid data is greater than 1, sequentially calculating the valid data to obtain the calculation result.
5. The method of claim 1, wherein, The step of data marking the data in the neural network model according to the data values comprises: determining whether the data values are in a valid data range; if the data values are in the valid data range, marking the data corresponding to the data values as valid data identifiers; if the data values are not in the valid data range, marking the data corresponding to the data values as invalid data identifiers.
6. The method of claim 1, wherein, The step of, if there is valid data in the plurality of groups of data, performing neural network calculation according to the valid data to obtain a calculation result, comprises: if there is valid data in the plurality of groups of data, performing convolution operation, pooling processing and classification operation on the valid data to obtain the calculation result.
7. The method of claim 1, wherein, After the step of, if there is valid data in the plurality of groups of data, performing neural network calculation according to the valid data to obtain a calculation result, the method further comprises: outputting the calculation result.
8. An apparatus for accelerating neural network computation, characterized by, The acceleration device for neural network calculation comprises a memory, a processor and a computer program stored on the memory and executable on the processor, and the processor implements the steps of the method for accelerating neural network calculation according to any one of claims 1 to 7 when executing the computer program.
9. A computer-readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium, and the processor implements the steps of the method for accelerating neural network calculation according to any one of claims 1 to 7 when executing the computer program.
Citation Information
Patent Citations
Arithmetic device and method for executing full connection layer in convolutional neural network
CN111178508A