A neural network accelerator

By designing the alternating connection of the convolution calculation module and the tail calculation module in the convolutional neural network accelerator, the tail calculation process is optimized, the problem of high resource consumption in the existing technology is solved, and efficient convolutional neural network processing performance is achieved. Suitable for embedded systems.

CN111753974BActive Publication Date: 2024-10-15SHENZHEN CORERAIN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010574432.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-22
Publication Date
2024-10-15
Estimated Expiration
2040-06-22

AI Technical Summary

Technical Problem

When improving performance, existing convolutional neural network accelerators are difficult to effectively optimize tail calculations, resulting in excessive resource consumption and high power consumption in embedded systems, limiting their applications.

Method used

A neural network accelerator is designed, including a convolution calculation module, a tail calculation module and a storage module. Multiple convolution calculation units are alternately connected with a small number of tail calculation units to optimize the tail calculation process, reduce resource consumption, and preset parameters. The configuration module flexibly sets the convolution kernel size and data storage location to improve processing efficiency.

Benefits of technology

It realizes the optimization of the tail calculation of the neural network accelerator, reduces resource consumption, improves processing performance, is suitable for embedded systems, and reduces power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111753974B_ABST
    Figure CN111753974B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a neural network accelerator, comprising: a convolution calculation module, used to perform convolution operation on input data of a preset neural network to obtain first output data; a tail calculation module, used to calculate the first output data to obtain second output data; a storage module, used to cache the input data and the second output data; a first control module, used to transmit the first output data to the tail calculation module; the convolution calculation module includes a plurality of convolution calculation units, the tail calculation module includes a plurality of tail calculation units, the first control module includes a plurality of first control units, and at least two convolution calculation units are connected to a tail calculation unit through a first control unit. The embodiment of the present invention optimizes the design of the tail calculation module in the neural network accelerator and reduces the resource consumption of the neural network accelerator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of neural network technology, and in particular to a neural network accelerator. Background Art

[0002] In recent years, convolutional neural networks have developed rapidly and are widely used in computer vision and natural language processing. However, the improvement of convolutional neural network accuracy is accompanied by a rapid increase in computing and storage costs. It is difficult to provide sufficient computing power using multi-core central processing units (CPUs). Although graphics processing units (GPUs) can process complex convolutional neural network models at high speed, their power consumption is too high, limiting their application in embedded systems.

[0003] Convolutional neural network accelerators based on FPGA and ASIC have the characteristics of high energy efficiency and large-scale parallel processing, and have gradually become a hot research topic. Since convolutional neural networks have a large number of parameters and require a large number of multiplication and addition operations, in order to achieve high convolutional neural network processing performance under limited resources, the main problem these accelerators solve is how to improve parallelism and reduce memory bandwidth requirements.

[0004] In the existing technology, when improving performance, the optimization is mainly focused on the convolutional layer or the fully connected layer. However, in a highly versatile convolutional neural network accelerator, the convolutional layer is often connected to other subsequent processing operations such as pooling, activation, shortcut, upsampling, etc. These operations are named tail calculations here. The optimization of these operations is also crucial in the design of convolutional neural network accelerators. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a neural network accelerator to optimize tail calculations in the neural network accelerator and reduce resource consumption.

[0006] An embodiment of the present invention provides a neural network accelerator, comprising:

[0007] A convolution calculation module, used for performing a convolution operation on input data of a preset neural network to obtain first output data;

[0008] A tail calculation module, used for calculating the first output data to obtain the second output data;

[0009] A storage module, used for caching the input data and the second output data;

[0010] A first control module, configured to transmit the first output data to the tail calculation module;

[0011] The convolution calculation module includes multiple convolution calculation units, the tail calculation module includes multiple tail calculation units, the first control module includes multiple first control units, and at least two convolution calculation units are connected to a tail calculation unit through a first control unit.

[0012] Furthermore, it also includes a second control module for transmitting the output data of the neural network calculation to the storage module, the second control module includes multiple second control units, and at least one of the tail calculation units is connected to the storage module through one of the second control units.

[0013] Furthermore, the data flow rate of the convolution calculation module is less than or equal to the data flow rate of the tail calculation module.

[0014] Furthermore, the sum of the on-chip resources consumed by the convolution computing module and the on-chip resources consumed by the tail computing module is less than or equal to the total on-chip resources. Furthermore, it also includes: a preset parameter configuration module, which is used to configure preset parameters, and the preset parameters include convolution kernel size, input feature map size, input data storage location and second output data storage location.

[0015] Furthermore, the convolution calculation unit includes a weight unit, an input feature map unit and a convolution kernel;

[0016] The weight unit is used to form a corresponding weight according to the convolution kernel size;

[0017] The input feature map unit is used to obtain input data from the storage module according to the input feature map size and the input data storage location to form a corresponding input feature map;

[0018] The convolution kernel is used to calculate the weight and the input feature map.

[0019] Furthermore, the convolution calculation unit is used to calculate the weight and the input feature map to obtain the first output data.

[0020] Furthermore, the storage module includes an on-chip memory and / or an off-chip memory.

[0021] Further, when the input data storage location is an off-chip memory, the input data in the off-chip memory is transferred to the on-chip memory through DMA.

[0022] Further, when the second output data storage location is an off-chip memory, the second output data is transferred to the off-chip memory through DMA.

[0023] The neural network accelerator provided in the first embodiment of the present invention is configured to perform convolution operation on input data of a preset neural network to obtain first output data through a convolution calculation module; a tail calculation module to calculate the first output data to obtain second output data; a storage module to cache the input data and the second output data; a first control module to transmit the first output data to the tail calculation module; the convolution calculation module includes a plurality of convolution calculation units, the tail calculation module includes a plurality of tail calculation units, the first control module includes a plurality of first control units, and at least two convolution calculation units are connected to a tail calculation unit through a first control unit. The design of the tail calculation module in the neural network accelerator is optimized, and the resource consumption of the neural network accelerator is reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 A schematic diagram of the structure of a neural network accelerator provided in Embodiment 1 of the present invention;

[0025] Figure 2 A schematic diagram of the structure of a neural network accelerator provided in Embodiment 2 of the present invention;

[0026] Figure 3 A schematic diagram of the structure of a neural network accelerator provided in Example 3 of the present invention. DETAILED DESCRIPTION

[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0028] It should be mentioned before discussing the exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0029] In addition, the terms "first", "second", etc. can be used in this article to describe various directions, actions, steps or elements, but these directions, actions, steps or elements are not limited by these terms. These terms are only used to distinguish a first direction, action, step or element from another direction, action, step or element. For example, without departing from the scope of the present application, the first output data can be the second output data, and similarly, the second output data can be referred to as the first output data. Both the first output data and the second output data are output data, but they are not the same output data. The terms "first", "second", etc. cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" can expressly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0030] Embodiment 1

[0031] Figure 1 This is a schematic diagram of the structure of a neural network accelerator provided in the first embodiment of the present invention, which can be applied to the calculation of neural networks. Figure 1 As shown, the neural network accelerator provided in the first embodiment of the present invention includes: a storage module 100, a convolution calculation module 200, a first control module 300 and a tail calculation module 400. The convolution calculation module 200 is used to perform a convolution operation on the input data of the preset neural network to obtain the first output data; the tail calculation module 400 is used to calculate the first output data to obtain the second output data; the storage module 100 is used to cache the input data and the second output data; the first control module 300 is used to transmit the first output data to the tail calculation module.

[0032] Furthermore, the convolution calculation module 200 includes multiple convolution calculation units 210, the tail calculation module 400 includes multiple tail calculation units 410, the first control module 300 includes multiple first control units 310, and at least two convolution calculation units 210 are connected to a tail calculation unit 410 through a first control unit 310.

[0033] For example, two convolution calculation units 210 are connected to a tail calculation unit 410 through a first control unit 310. When the neural network accelerator is used to calculate the neural network, the input data is first convolutionally calculated by the convolution calculation module 200, and the first output data output by the convolution calculation module 200 also needs to be processed by the tail calculation module 400, such as pooling, activation, shortcut, upsampling, etc. These processes are collectively referred to as tail calculations, and finally the tail calculation module 400 outputs the second output data calculated by the final neural network accelerator.

[0034] Exemplarily, the first convolution calculation unit 210 is recorded as PE1, and the first output data calculated by it is recorded as PI1. The second convolution calculation unit 210 is recorded as PE2, and the first output data calculated by it is recorded as PI2. Since the convolutional neural network adopts a parallel computing method, that is, the convolution calculation unit PE1 and the convolution calculation unit PE2 perform calculations at the same time, the first output data PI1 and the first output data PI2 will be input into the first control unit 310 at the same time, and one tail calculation unit 410 can only perform tail calculation on one first output data at a time. Therefore, the first control unit 310 first inputs the first output data PI1 into the tail calculation unit 410, and caches the first output data PI2 at the same time. When the tail calculation unit 410 completes the tail calculation of the first output data PI1, the first control unit 310 inputs the cached first output data PI2 into the tail calculation unit 410 for calculation.

[0035] In this embodiment, two convolution calculation units 210 are connected to a tail calculation unit 410 through a first control unit 310, and the first output data output by one of the two convolution calculation units 210 is alternately output to the tail calculation unit 410 through the first control unit 310, so that the two convolution calculation units share one tail calculation unit 410, thereby reducing the number of tail calculation units 410, thereby reducing the resource consumption of the neural network accelerator.

[0036] The neural network accelerator provided in the first embodiment of the present invention is configured to perform convolution operation on input data of a preset neural network to obtain first output data through a convolution calculation module; a tail calculation module to calculate the first output data to obtain second output data; a storage module to cache the input data and the second output data; a first control module to transmit the first output data to the tail calculation module; the convolution calculation module includes a plurality of convolution calculation units, the tail calculation module includes a plurality of tail calculation units, the first control module includes a plurality of first control units, and at least two convolution calculation units are connected to a tail calculation unit through a first control unit. The design of the tail calculation module in the neural network accelerator is optimized, and the resource consumption of the neural network accelerator is reduced.

[0037] Embodiment 2

[0038] Figure 2 This is a schematic diagram of the structure of a neural network accelerator provided in the second embodiment of the present invention. This embodiment is a further refinement of the above embodiment. Figure 2As shown, the neural network accelerator provided by the second embodiment of the present invention includes: a storage module 100, a convolution calculation module 200, a first control module 300, a tail calculation module 400 and a second control module 500. The convolution calculation module 200 is used to perform a convolution operation on the input data of the preset neural network to obtain the first output data; the tail calculation module 400 is used to calculate the first output data to obtain the second output data; the storage module 100 is used to cache the input data and the second output data; the first control module 300 is used to transmit the first output data output by the convolution calculation module 200 to the tail calculation module 400; the second control module 500 is used to transmit the second output data output by the tail calculation module 400 to the storage module 100.

[0039] Further, the convolution calculation module 200 includes a plurality of convolution calculation units 210, the tail calculation module 400 includes a plurality of tail calculation units 410, the first control module 300 includes a plurality of first control units 310, the second control module 500 includes a plurality of second control units 510, at least two convolution calculation units are connected to a tail calculation unit 410 via a first control unit 310, and at least one tail calculation unit 410 is connected to the storage module 100 via a second control unit 510. When the neural network accelerator is used to calculate the neural network, the input data is first convolutionally calculated by the convolution calculation module 200, and the first output data output by the convolution calculation module 200 also needs to be processed by the tail calculation module 400, such as pooling, activation, shortcut (direct connection), upsampling and other processing, which are collectively referred to as tail calculation, and finally the tail calculation module 400 outputs the second output data calculated by the final neural network accelerator.

[0040] For example, Figure 2As shown, taking the example that two convolution calculation units 210 are connected to a tail calculation unit 410 through a first control unit 310, and a tail calculation unit 410 is connected to a storage module through a second control unit 510, the first convolution calculation unit 210 is denoted as PE1, and the first output data calculated by it is denoted as PI1, the second convolution calculation unit 210 is denoted as PE2, and the first output data calculated by it is denoted as PI2, the second output data obtained by the tail calculation unit 410 performing tail calculation on the first output data PI1 is denoted as PO1, and the second output data obtained by the tail calculation unit 410 performing tail calculation on the first output data PI2 is denoted as PO2. Since the convolutional neural network adopts a parallel computing method, that is, the convolution computing unit PE1 and the convolution computing unit PE2 perform calculations at the same time, the first output data PI1 and the first output data PI2 will be input into the first control unit 310 at the same time, and one tail computing unit 410 can only perform tail computing on one first output data at a time. Therefore, the first control unit 310 first inputs the first output data PI1 into the tail computing unit 410, and caches the first output data PI2 at the same time. When the tail computing unit 410 completes the tail computing of the first output data PI1, the first control unit 310 then inputs the cached first output data PI2 into the tail computing unit 410 for computing. When the tail computing unit 410 completes the tail computing of the first output data PI1, it also inputs the obtained second output data PO1 into the second control unit 510. Normally, the output data calculated by the neural network accelerator needs to be output simultaneously. Therefore, when the second control unit 510 receives the second output data PO1, the first output data PI2 has not yet been calculated, and the second output data PO2 cannot be obtained. The second control unit 510 first caches the second output data PO1, and when the second output data PO2 transmitted by the tail calculation unit 410 is received, the second output data PO1 and the second output data PO2 are stored in the storage module at the same time.

[0041] In this embodiment, the data input and output mode of the first control unit 310 is called 2-input 1-output, that is, the first control unit 310 receives two first output data at the same time, but outputs one first output data at a time. The data input and output mode of the second control unit 510 is called 1-input 2-output, that is, the first control unit 310 receives one second output data at a time, but outputs two second output data at the same time. Further, if two tail calculation units 410 are connected to the storage module 100 through one second control unit 510, it is equivalent to the second control unit 510 receiving two second output data at the same time, and then outputting four second output data at the same time.

[0042] Further, the data flow rate of the convolution calculation module 200 is less than or equal to the data flow rate of the tail calculation module 400. The data flow rate of the convolution calculation module 200 refers to the sum of the data flow rates in all the convolution calculation units 210, and the data flow rate of the tail calculation module 400 refers to the sum of the data flow rates in all the tail calculation units 410. Since at least two convolution calculation units 210 are connected to a tail calculation unit 410 through a first control unit 310, that is, the number of tail calculation units 410 is less than the number of convolution calculation units 210, and the number of tail calculation units 410 is usually an integer multiple of the number of convolution calculation units 210, therefore, the data flow rate of the tail calculation module 400 is greater than or equal to the data flow rate of the convolution calculation module 200, so as to ensure that the tail calculation module 400 can process the first output data of the convolution calculation module 200 in a timely manner, thereby ensuring the smoothness of data flow. Assuming that the number of convolution computing units 210 is n, the data flow rate in each convolution computing unit 210 is v1 (i.e., the amount of data processed by each convolution computing unit 210 per unit time), the number of tail computing units 410 is m, and the data flow rate in each tail computing unit 410 is v2 (i.e., the amount of data processed by each tail computing unit 410 per unit time), then, m*v2≥n*v1.

[0043] Further, the sum of the on-chip resources consumed by the convolution calculation module 200 and the on-chip resources consumed by the tail calculation module 400 is less than or equal to the total on-chip resources. The on-chip resources consumed by the convolution calculation module 200 refer to the sum of the on-chip resources consumed by all the convolution calculation units 210, and the on-chip resources consumed by the convolution calculation unit 210 refer to the storage resources (Memory), computing resources (such as LUT (Look-Up-Table), DSP (Digital Signal Processing), etc.), system resources, etc. consumed by the convolution calculation unit 210 for calculation. The on-chip resources consumed by the tail calculation module 400 refer to the sum of the on-chip resources consumed by all the tail calculation units 410, and the on-chip resources consumed by the tail calculation unit 410 refer to the storage resources (Memory), computing resources (such as LUT (Look-Up-Table), DSP (Digital Signal Processing), etc.), system resources, etc. consumed by the tail calculation unit 410 for calculation. Assuming that the number of convolution computing units 210 is n, the on-chip resources consumed by each convolution computing unit 210 are x, the number of tail computing units 410 is m, the on-chip resources consumed by each tail computing unit 410 are y, and the total on-chip resources are z, then, m*y+n*x≤z.

[0044] In the second embodiment of the present invention, a second control module is provided to transmit the output data of the neural network calculation to the storage module. The second control module includes multiple second control units. At least one of the tail calculation units is connected to the storage module through one of the second control units, so that the rate at which the tail calculation unit transmits data to the storage module is controlled by the second control unit. When the amount of data is large, the second control unit plays a certain buffering role.

[0045] Embodiment 3

[0046] Figure 3 This is a schematic diagram of the structure of a neural network accelerator provided in the third embodiment of the present invention. This embodiment is a further refinement of the storage module and the convolution calculation unit in the above embodiment. Figure 3 As shown, the neural network accelerator provided by the third embodiment of the present invention includes: a storage module 100, a convolution calculation module 200, a first control module 300, a tail calculation module 400, a second control module 500 and a preset parameter configuration module 600. The convolution calculation module 200 is used to perform a convolution operation on the input data of the preset neural network to obtain the first output data; the tail calculation module 400 is used to calculate the first output data to obtain the second output data; the storage module 100 is used to cache the input data and the second output data; the first control module 300 is used to transmit the first output data output by the convolution calculation module 200 to the tail calculation module 400; the second control module 500 is used to transmit the second output data output by the tail calculation module 400 to the storage module 100; the preset parameter configuration module 600 is used to configure the preset parameters.

[0047] Further, the convolution calculation module 200 includes multiple convolution calculation units 210, the tail calculation module 400 includes multiple tail calculation units 410, the first control module 300 includes multiple first control units 310, and at least two convolution calculation units are connected to one tail calculation unit 410 through one first control unit 310. The second control module 500 includes multiple second control units 510, and at least one tail calculation unit is connected to the storage module 100 through one second control unit 510. Exemplarily, Figure 3 The neural network accelerator shown shows that two convolution computing units are connected to a tail computing unit 410 via a first control unit 310 , and the two tail computing units are connected to the storage module 100 via a second control unit 510 .

[0048] Furthermore, the preset parameters include but are not limited to the convolution kernel size, the input feature map size, the input data storage location and the second output data storage location. The convolution calculation of the neural network is usually to perform multiplication and addition operations on the input data and the corresponding weight data to obtain the first output data. The data during the calculation is usually represented in the form of a feature map. For example, the input data is called the input feature map, and the first output data is called the first output feature map. The feature map represents an a*b two-dimensional matrix data structure defined by a columns and b rows. The convolution kernel size represents the size of the weight, and the input feature map size represents the size of the input feature map. For example, if the convolution kernel size is 3*3, it means that the weight is a 3*3 two-dimensional matrix data structure, including 9 data.

[0049] Furthermore, the convolution calculation unit 210 includes an input feature map unit 211, a convolution kernel 212 and a weight unit 213, the weight unit 213 is used to form a corresponding weight according to the convolution kernel size; the input feature map unit 211 is used to obtain input data from the storage module according to the input feature map size and the input data storage location to form a corresponding input feature map; the convolution kernel 212 is used to calculate the weight and the input feature map.

[0050] Further, the storage module 100 includes an off-chip memory 110 and / or an on-chip memory 120, and the input data storage location and the second output data storage location may be an on-chip memory or an off-chip memory. Figure 3 Taking the off-chip memory as an example, when the input data is stored in the off-chip memory 110, the input data of the off-chip memory 110 is transferred to the on-chip memory 120 by DMA (Direct Memory Access), and the convolution calculation unit 210 directly obtains the input data from the on-chip memory 120. When the second output data storage location is the off-chip memory, the second control unit 510 directly outputs the second output data to the off-chip memory 110 by DMA. Optionally, when both the input data storage location and the second output data storage location are on-chip memories, the convolution calculation unit 210 can directly obtain the input data from the on-chip memory, and the second control unit can also directly transfer the second output data to the on-chip memory.

[0051] Furthermore, due to the characteristics of the convolutional neural network itself, the data flow rates in the convolution computing unit and the tail computing unit may be different in different network layers. Therefore, for different network layers, the optimal number of convolution computing units n and the number of tail computing units m may be different. Therefore, the preset parameter configuration module 600 can also be used to set in each network layer: the number of convolution computing units n, the number of first control units, the number of tail computing units m, the number of second control units, the ratio k of convolution computing units to first control units, and the ratio q of tail computing units to second control units. Among them, the number n of convolution calculation units and the number m of tail calculation units can be designed with reference to the following process: from m*v2≥n*v1, we can get: n≤m*v2 / v1, from m*y+n*x≤z, we can get: n≤(zm*y) / x, it can be seen that when m*v2 / v1=(zm*y) / x, the maximum value of n can be obtained. At this time, m=z*v1 / (x*v2+y*v1), n=z*v2 / (x*v2+y*v1), since n and m are both integers, and n is an integer multiple of m, so: m=floor[z*v1 / (x*v2+y*v1)], n=floor[z*v2 / (x*v2+y*v1)], where the floor function means rounding down. Exemplarily, let z=1000, x=50, y=30, v1=1, v2=2, then m=floor[z*v1 / (x*v2+y*v1)]=7, n=floor[z*v2 / (x*v2+y*v1)]=14, then k=2 can be set, indicating that two convolution calculation units are connected to one tail calculation unit through one first control unit, from which it can be seen that the ratio k of the convolution calculation unit to the first control unit can be set to the ratio of the number n of the convolution calculation units to the number m of the tail calculation units. Since the second control unit needs to output all the second output data at the same time, the ratio q of the tail calculation unit to the second control unit can be set according to actual needs. For example, setting q=2 means that the two tail calculation units are connected to the storage module through one second control unit, specifically: one second control unit receives two second output data at the same time in one clock cycle, then after two clock cycles, one second control unit outputs four second output data at the same time.

[0052] Furthermore, since tail calculations include but are not limited to pooling, activation, shortcut, upsampling and other processes, but not every neural network needs to perform all tail calculation processes when performing calculations, the preset parameter configuration module 600 can also be used to set the specific tail calculation processes that need to be performed. For example, setting the corresponding operation to 1 indicates that the process needs to be performed, and setting the corresponding operation to 0 indicates that the process does not need to be performed. For example, pooling is set to 1, activation is set to 1, shortcut is set to 0, and upsampling is set to 0, which means that the tail processing unit only needs to perform pooling and activation operations on the input first output data, and does not perform shortcut and upsampling operations.

[0053] Embodiment 3 of the present invention performs preset parameter configuration through a preset parameter configuration module, and can flexibly set and change various preset parameters such as convolution kernel size, input feature map size, input data storage location and second output data storage location, thereby improving the flexibility of the neural network accelerator design.

[0054] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A neural network accelerator, characterized in that: include: A convolution calculation module, used for performing a convolution operation on input data of a preset neural network to obtain first output data; A tail calculation module, used for calculating the first output data to obtain the second output data; A storage module, used for caching the input data and the second output data; A first control module, configured to transmit the first output data to the tail calculation module; The convolution calculation module includes a plurality of convolution calculation units, the tail calculation module includes a plurality of tail calculation units, the first control module includes a plurality of first control units, and at least two convolution calculation units are connected to a tail calculation unit through a first control unit; Wherein, the first control unit is used to alternately input the output data of at least two convolution calculation units into a tail calculation unit connected to the control unit; The neural network accelerator further includes a second control module for transmitting output data of the neural network calculation to the storage module, the second control module includes a plurality of second control units, and at least one of the tail calculation units is connected to the storage module through one of the second control units; The second control unit is specifically used to control the second output data of the tail calculation unit to be stored in the storage module at the same time.

2. The neural network accelerator according to claim 1, characterized in that: The data flow rate of the convolution calculation module is less than or equal to the data flow rate of the tail calculation module.

3. The neural network accelerator according to claim 1, characterized in that: The sum of the on-chip resources consumed by the convolution computing module and the on-chip resources consumed by the tail computing module is less than or equal to the total on-chip resources.

4. The neural network accelerator according to claim 1, characterized in that: Also includes: The preset parameter configuration module is used to configure preset parameters, wherein the preset parameters include convolution kernel size, input feature map size, input data storage location and second output data storage location.

5. The neural network accelerator according to claim 4, characterized in that: The convolution calculation unit includes a weight unit, an input feature map unit and a convolution kernel; The weight unit is used to form a corresponding weight according to the convolution kernel size; The input feature map unit is used to obtain input data from the storage module according to the input feature map size and the input data storage location to form a corresponding input feature map; The convolution kernel is used to calculate the weight and the input feature map.

6. The neural network accelerator according to claim 5, characterized in that: The convolution calculation unit is used to calculate the weight and the input feature map to obtain the first output data.

7. The neural network accelerator according to claim 4, characterized in that: The storage module includes an on-chip memory and / or an off-chip memory.

8. The neural network accelerator according to claim 7, characterized in that: When the input data storage location is an off-chip memory, the input data in the off-chip memory is transferred to an on-chip memory through DMA.

9. The neural network accelerator according to claim 7, characterized in that: When the second output data storage location is an off-chip memory, the second output data is transferred to the off-chip memory through DMA.