Storage method, computing method, storage device, many-core system, medium

By storing only non-zero connection weights and weight indexes in the neural network, the problem of large space occupancy of connection weights is solved, and resource saving and efficiency improvement in sparse neural networks are achieved.

CN114780039BActive Publication Date: 2024-11-19LYNXI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210474983.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2024-11-19
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

The improvement in the accuracy of the connection weight in existing neural networks leads to a large amount of storage space. Especially in sparse neural networks, many connection weights are zero but still need to be stored, resulting in waste of resources.

Method used

A method for storing the weights of the neural network connection is proposed. By obtaining the weight index and effective weight values ​​of the pending neuron, only non-zero connection weights are stored. The weight index is used to indicate whether the front-end neuron connected to the pending neuron is zero, saving Storage space.

Benefits of technology

It effectively reduces the storage space occupied by the neural network connection weight, especially in sparse neural networks, which significantly reduces the storage cost and improves resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114780039B_ABST
    Figure CN114780039B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for storing connection weights of a neural network, the method comprising: obtaining a weight index of a neuron to be processed of a neural network, the weight index of the neuron to be processed comprising identification information corresponding to all front-end neurons of the neuron to be processed, each identification information being used to indicate whether the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero; obtaining an effective weight value of the neuron to be processed, the effective weight value of the neuron to be processed comprising all connection weights corresponding to the front-end neurons whose connection weights with the neuron to be processed are not zero; storing the weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index. The present disclosure also provides a method for calculating neuron input data of a neural network, a neural network connection weight storage device, a multi-core system, and a computer-readable medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a method for storing connection weights of a neural network, a method for calculating neuron input data of a neural network, a device for storing connection weights of a neural network, a many-core system, and a computer-readable medium. Background Art

[0002] With the continuous development of artificial intelligence technology, the application of neural networks is becoming more and more extensive. The neural network in artificial intelligence technology is composed of a large number of neurons, each neuron can be connected to other neurons, and the connection strength between neurons is represented by the connection weight.

[0003] The higher the precision of the connection weights, the better the performance (such as accuracy) of the neural network. However, the higher the precision of the connection weights, the more storage space they occupy, and the storage cost of the neural network will also increase. Summary of the invention

[0004] The present disclosure provides a method for storing connection weights of a neural network, a method for calculating neuron input data of a neural network, a device for storing connection weights of a neural network, a many-core system, and a computer-readable medium.

[0005] In a first aspect, the present disclosure provides a method for storing connection weights of a neural network, which includes: obtaining a weight index of a neuron to be processed of a neural network, wherein the weight index of the neuron to be processed includes identification information corresponding one-to-one to all front-end neurons of the neuron to be processed, and each identification information is used to indicate whether the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero; obtaining an effective weight value of the neuron to be processed, wherein the effective weight value of the neuron to be processed includes the connection weights corresponding to all front-end neurons whose connection weights with the neuron to be processed are not zero; and storing the weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index.

[0006] In a second aspect, the present disclosure provides a method for calculating neuron input data of a neural network, wherein the neural network has at least one target neuron, and the connection weight between the target neuron and the front-end neuron is stored using the above-mentioned neural network connection weight storage method, and the method includes: calculating the input data of the target neuron based on the output data of the front-end neuron of the target neuron, the identification information corresponding to the front-end neuron, and the connection weight between the front-end neuron and the target neuron.

[0007] In a third aspect, the present disclosure provides a neural network connection weight storage device, which includes: a first module, used to obtain the weight index of the neuron to be processed of the neural network, the weight index of the neuron to be processed includes identification information corresponding to all front-end neurons of the neuron to be processed, and each identification information is used to indicate whether the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero; a second module, used to obtain the effective weight value of the neuron to be processed, the effective weight value of the neuron to be processed includes the connection weights corresponding to all front-end neurons whose connection weights with the neuron to be processed are not zero; a third module, used to store the weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index.

[0008] In a fourth aspect, the present disclosure provides a many-core system, which includes: multiple processing cores, at least some of the processing cores have neurons, and the neurons on the multiple processing cores form a neural network; a storage space, on which data stored using the above-mentioned neural network connection weight storage method is stored; an on-chip network, which is configured to exchange data between the multiple processing cores and the data stored in the storage space; one or more instructions are stored in one or more of the processing cores, and one or more of the instructions are executed by one or more of the processing cores, so that one or more of the processing cores can execute the above-mentioned method of calculating neuron input data of the neural network.

[0009] In a fifth aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processing core, implements the above-mentioned method for storing connection weights of a neural network and the above-mentioned method for calculating neuron input data of a neural network.

[0010] The neural network connection weight storage method, neural network neuron input data calculation method, neural network connection weight storage device, many-core system, and computer-readable medium provided by the present disclosure only need to store connection weights that are not zero. When the connection weight between the neuron to be processed and one or more front-end neurons is zero, the space occupied by the connection weight storage can be saved.

[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings, in which:

[0013] Figure 1 A flowchart of a method for storing neural network connection weights provided in an embodiment of the present disclosure;

[0014] Figure 2 A flowchart of a method for calculating neuron input data of a neural network provided by an embodiment of the present disclosure;

[0015] Figure 3 A flowchart of another method for calculating neuron input data of a neural network provided by an embodiment of the present disclosure;

[0016] Figure 4 This is a schematic diagram of the connections of some neurons in a neural network;

[0017] Figure 5 A weight index and effective weight value of a neuron obtained by using a neural network connection weight storage method provided by the present disclosure;

[0018] Figure 6 A block diagram of a neural network connection weight storage device provided in an embodiment of the present disclosure;

[0019] Figure 7 A block diagram of the composition of a many-core system provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0021] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.

[0022] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0023] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "including" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. "Connected" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect.

[0024] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.

[0025] Figure 1 A flowchart of a method for storing neural network connection weights provided in an embodiment of the present disclosure.

[0026] Reference Figure 1 , an embodiment of the present disclosure provides a method for storing connection weights of a neural network.

[0027] The neural network of the embodiment of the present disclosure may be a spiking neural network (SNN), an artificial neural network (ANN), or other neural networks composed of multiple neurons, and is used to perform any of image processing tasks, speech processing tasks, text processing tasks, and video processing tasks.

[0028] The neural network of the disclosed embodiment may be a neural network loaded on a many-core system, wherein at least some of the processing cores of the many-core system correspond to one or more neurons of the neural network, and the connection weights of the one or more neurons with other neurons may be stored in the on-chip storage space corresponding to these processing cores, or may be stored in an external storage space outside the many-core system. These processing cores may read the connection weights of the one or more neurons with other neurons from the corresponding on-chip storage space or external storage space, and calculate the input data and output data of the one or more neurons.

[0029] The method for storing neural network connection weights of the embodiments of the present disclosure may be executed by a device with computing capabilities in a many-core system, such as a processing core in the many-core system, and may be implemented by the processing core calling computer-readable program instructions stored in the storage space of the many-core system; the method for storing neural network connection weights of the embodiments of the present disclosure may also be executed by an electronic device with computing capabilities outside the many-core system, such as a server connected to the many-core system.

[0030] The method for storing neural network connection weights in the embodiment of the present disclosure includes:

[0031] S101. Obtain a weight index of a neuron to be processed of a neural network. The weight index of the neuron to be processed includes identification information corresponding to all front-end neurons of the neuron to be processed one by one. Each identification information is used to indicate whether a connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero.

[0032] The weight index of the to-be-processed neuron constituting the neural network is obtained. The weight index of the to-be-processed neuron includes a plurality of identification information. Each identification message corresponds to a front-end neuron connected to the to-be-processed neuron, and is used to indicate whether the connection weight between the front-end neuron and the to-be-processed neuron is zero.

[0033] The neuron to be processed may be any neuron in the neural network that is connected to a front-end neuron. The number of front-end neurons corresponding to different neurons to be processed may be different.

[0034] Optionally, each identification information is 1-bit data, 0 indicates that the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero, and 1 indicates that the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is not zero.

[0035] The storage space occupied by each identification information in the weight index is 1 bit (1 bit), for example, it can be 1 or 0, 1 can indicate that the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is not zero, and 0 can indicate that the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero.

[0036] If the neuron to be processed has 4 front-end neurons connected to it, namely the first neuron, the second neuron, the third neuron, and the fourth neuron, among which the connection weights of the first neuron and the third neuron with the neuron to be processed are not zero, and the connection weights of the second neuron and the fourth neuron with the neuron to be processed are zero, then the weight index of the neuron to be processed is 1010.

[0037] Using 0 to indicate that the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero, and using 1 to indicate that the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is not zero is both in line with logical habits and convenient for computer processing.

[0038] S102, obtaining an effective weight value of the neuron to be processed, where the effective weight value of the neuron to be processed includes connection weights corresponding to all front-end neurons whose connection weights with the neuron to be processed are not zero.

[0039] Obtaining the effective weight value of the neuron to be processed, wherein the effective weight value of the neuron to be processed includes the non-zero value in the connection weight between the neuron to be processed and the front-end neuron.

[0040] S103, storing the weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index.

[0041] The acquired weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index are stored.

[0042] Among them, the effective weight values ​​corresponding to the order of identification information in the weight index mean that the arrangement order of the front-end neurons corresponding to the effective weight value connection weights is consistent with the arrangement order of the front-end neurons corresponding to the identification information in the weight index indicating that the connection weight with the neuron to be processed is not zero.

[0043] The process of acquiring and storing the weight index and the effective weight value of the neuron to be processed can be performed synchronously to ensure that the order of the identification information in the weight index corresponds to the order of the connection weights in the effective weight value.

[0044] For example, the connection weight between the neuron to be processed and a front-end neuron is obtained, and when the connection weight is not zero, the identification information corresponding to the front-end neuron is written into the weight index of the neuron to be processed, and the connection weight between the neuron to be processed and the neuron is written into the effective weight value of the neuron to be processed; when the connection weight is zero, it is only necessary to write the identification information corresponding to the front-end neuron into the weight index of the neuron to be processed, and there is no need to process the effective weight value of the neuron to be processed.

[0045] Optionally, the weight index and effective weight value of the neuron to be processed can be stored in the on-chip storage space of the many-core system, such as the storage space of the processing core corresponding to the neuron to be processed, so that the processing core corresponding to the neuron to be processed can read the connection weight between the neuron to be processed and the front-end neuron when calculating the input data or output data of the neuron to be processed.

[0046] The storage space of the processing core corresponding to the neuron to be processed may be the storage space within the processing core corresponding to the neuron to be processed, or may be the storage space shared by the processing core corresponding to the neuron to be processed and other processing cores of the multi-core system.

[0047] Optionally, the weight index of the neuron to be processed and the valid weight value corresponding to the order of the identification information in the weight index are stored in an external storage space outside the many-core system.

[0048] That is to say, the weight index and effective weight value of the neuron to be processed can be stored in an additional storage space outside the many-core system, which can further reduce the storage space occupied by the connection weights in the many-core system.

[0049] Compared with the related art, in which the connection weights of the neuron to be processed and all the front-end neurons are stored one by one (even if the connection weight of the stored neuron and the front-end neuron is zero, the connection weight needs to be stored), the connection weights of the neuron to be processed and the front-end neuron are stored using the neural network connection weight storage method provided in the embodiment of the present disclosure. Although the weight index needs to be stored, the connection weight with zero connection weight does not need to be stored. When the connection weight of the neuron to be processed and one or more front-end neurons is zero, the space occupied by the connection weight storage can be saved by using the neural network connection weight storage method provided in the embodiment of the present disclosure. Moreover, the more the connection weights of the neuron to be processed and the front-end neurons are zero, the more storage space can be saved by using the neural network connection weight storage method provided in the embodiment of the present disclosure.

[0050] For example, if a neuron to be processed has 10 front-end neurons connected to it, and each connection weight occupies 8 bits of storage space, in the related technology, it is necessary to store the connection weights of the neuron to be processed and the front-end neurons one by one, and the storage space occupied by the connection weights of the neuron to be processed and the front-end neurons is 10*8bit=80bit.

[0051] In the neural network connection weight storage method provided by the embodiment of the present disclosure, each identification information in the weight index occupies 1 bit of storage space, and the total storage space occupied by the weight index is 1 bit*10=10 bits.

[0052] At the same time, since there is no need to store the connection weights with zero connection weights, if the connection weights between the neuron to be processed and the 5 front-end neurons are not zero, and the connection weights of the 5 front-end neurons are zero, the storage space occupied by the effective weight value is 5*8bit=40bit, and the total storage space occupied by the weight index and the effective weight value is 10bit+40bit=50bit, which is less than 80bit (i.e., the storage space occupied by the connection weights between the neuron to be processed and the front-end neurons in the related technology).

[0053] If the connection weight between the neuron to be processed and the three front-end neurons is not zero, and the connection weight of the seven front-end neurons is zero, then the storage space occupied by the effective weight value is 3*8bit=24bit, and the total storage space occupied by the weight index and the effective weight value is 10bit+24bit=34bit, which is not only much smaller than 80bit (i.e., the storage space occupied by the connection weight between the neuron to be processed and the front-end neurons in the related technology), but also smaller than 50bit (the storage space occupied by the connection weight between the neuron to be processed and the front-end neurons in the provided neural network connection weight storage method when the connection weight between the neuron to be processed and the five front-end neurons is not zero).

[0054] In actual industrial production, among the multiple neurons that make up a neural network, there are a large number of neurons whose connection weights with one or more front-end neurons are zero, especially in a sparse neural network. The proportion of neurons that have a connection weight of zero with one or more front-end neurons in the sparse neural network is much larger than that of an ordinary neural network. Using the neural network connection weight storage method provided in an embodiment of the present disclosure to store the connection weights between neurons of the neural network can greatly reduce the storage space occupied by the connection weights of the neural network. The sparser the network (i.e., the higher the proportion of neurons that have a connection weight of zero with one or more front-end neurons), the smaller the storage space occupied by the connection weights, and the smaller the storage cost of the neural network.

[0055] For a neural network, it can use the neural network connection weight storage method provided in the embodiment of the present disclosure to store the connection weights of all neurons (with the front-end neurons), or it can use the neural network connection weight storage method provided in the embodiment of the present disclosure to store the connection weights of some neurons (with the front-end neurons).

[0056] Figure 2 A flowchart of a method for calculating neuron input data of a neural network provided in an embodiment of the present disclosure.

[0057] Reference Figure 2 , an embodiment of the present disclosure provides a method for calculating neuron input data of a neural network.

[0058] Among them, the neural network of the embodiment of the present disclosure can be the above-mentioned neural network loaded on the many-core system, and the neural network has at least one target neuron, and the connection weight between the target neuron and the front-end neuron is stored using the neural network connection weight storage method of the embodiment of the present disclosure.

[0059] That is, the connection weight between the target neuron and the front-end neuron is stored in two parts, one is the weight index, and the other is the effective weight value. Among them, the weight index includes the identification information corresponding to the front-end neuron of the target neuron one by one, and the identification information indicates whether the connection weight between the front-end neuron corresponding to the identification information and the target neuron is zero. The effective weight value includes the connection weights corresponding to all the front-end neurons whose connection weights with the target neuron are not zero.

[0060] The method for calculating neuron input data of the neural network of the embodiment of the present disclosure includes:

[0061] S201, calculating input data of a target neuron according to output data of a front-end neuron of the target neuron, identification information corresponding to the front-end neuron, and a connection weight between the front-end neuron and the target neuron.

[0062] After receiving the output data of the front-end neuron of the target neuron, the identification information of the connection weight between the target neuron and the front-end neuron is obtained from the weight index of the target neuron. When the identification information indicates that the connection weight between the target neuron and the front-end neuron is not zero, the connection weight between the target neuron and the front-end neuron is read from the effective weight value of the target neuron, and the input data of the front-end neuron to the target neuron is calculated based on the output data of the front-end neuron and the connection weight between the target neuron and the front-end neuron.

[0063] The output data of the front-end neuron of the target neuron includes the emission information of the front-end neuron. When the front-end neuron emits to the target neuron, the output data of the front-end neuron may be a value indicating the emission of the front-end neuron.

[0064] For example, when the neural network is a pulse neural network, when the front-end neuron emits an activation pulse, the corresponding output data is 1, and when the front-end neuron emits an inhibition pulse, the corresponding output data is -1.

[0065] When the front-end neuron does not emit to the target neuron, the output data of the front-end neuron is a value indicating that the front-end neuron did not emit, such as 0.

[0066] When there are multiple front-end neurons for the target neuron, the output data of these multiple front-end neurons is a string consisting of 0, 1, and -1.

[0067] For example, the target neuron has four front-end neurons connected to it, namely the first neuron, the second neuron, the third neuron, and the fourth neuron. The first neuron sends an activation pulse to the target neuron, the second neuron sends an inhibition pulse to the target neuron, and neither the third neuron nor the fourth neuron sends a pulse to the target neuron. The outputs of these four front-end neurons are -1, 1, 0, and 0, respectively, which form a binary string of 11010000, where every two bits correspond to the output of a front-end neuron.

[0068] In some cases, when the front-end neuron emits (whether it emits an activation pulse or an inhibitory pulse), the corresponding output is 1; if the front-end neuron does not emit to the target neuron, the output of the front-end neuron is 0.

[0069] When there are multiple front-end neurons for the target neuron, the output data of these multiple front-end neurons is a string composed of 0s and 1s.

[0070] For example, the target neuron has four front-end neurons connected to it, namely the first neuron, the second neuron, the third neuron, and the fourth neuron. Among them, the first neuron emits to the target neuron, and the second neuron, the third neuron, and the fourth neuron do not emit to the target neuron. Then the outputs of these four front-end neurons are 1, 0, 0, and 0, respectively, which form a character string 1000.

[0071] When the connection weights between the target neuron and the front-end neuron are stored in the on-chip storage space of the many-core system, after receiving the emission information of the front-end neuron, the input data of the target neuron can be directly determined based on the stored connection weights and emission information.

[0072] When the connection weights between the target neuron and the front-end neuron are stored in an external storage space outside the many-core system, after receiving the emission information of the front-end neuron, it is necessary to read the corresponding connection weights from the external storage space, and then determine the input data of the target neuron based on the connection weights and the emission information.

[0073] The input data of the target neuron may be a value calculated based on the value actually involved in the calculation of the target neuron (such as threshold emission judgment).

[0074] Since only when the connection weight between the front-end neuron and the target neuron is not zero and the front-end neuron emits to the target neuron, the connection weight between the front-end neuron and the target neuron and the emission information of the front-end neuron can participate in the calculation of the threshold emission judgment of the target neuron, therefore, when the output data of the front-end neuron is zero (that is, the front-end neuron does not emit to the target neuron), even if the connection weight between the front-end neuron and the target neuron is not zero, the connection weight between the front-end neuron and the target neuron cannot participate in the calculation of the input data of the target neuron. When the connection weight between the front-end neuron and the target neuron is zero, even if the front-end neuron emits to the target neuron, the emission information of the front-end neuron cannot participate in the calculation of the input data of the target neuron.

[0075] For example, the target neuron has four front-end neurons connected to it, namely the first neuron, the second neuron, the third neuron, and the fourth neuron. The connection weights between the first neuron and the third neuron and the target neuron are not zero, the connection weights between the second neuron and the fourth neuron and the target neuron are zero, and the first neuron emits to the target neuron, while the second neuron, the third neuron, and the fourth neuron do not emit to the target neuron.

[0076] Since the connection weights between the second neuron and the fourth neuron and the target neuron are zero, even if the second neuron and the fourth neuron emit to the target neuron, the emission information of the second neuron and the fourth neuron cannot be used to calculate the input data of the target neuron.

[0077] Although the connection weight between the third neuron and the target neuron is not zero, the third neuron does not emit to the target neuron. Therefore, the connection weight of the third neuron cannot participate in the calculation of the input data of the target neuron.

[0078] The connection weight between the first neuron and the target neuron is not zero, and the first neuron emits to the target neuron. Therefore, the connection weight between the first neuron and the target neuron and the emission information of the first neuron can participate in calculating the input data of the target neuron.

[0079] Optionally, the input data of the target neuron is calculated based on the result of an AND operation between the output of the front-end neuron of the target neuron and the identification information corresponding to the front-end neuron, and the connection weight between the front-end neuron and the target neuron.

[0080] Since the connection weights between the target neuron and the front-end neuron are stored using the neural network connection weight storage method of the embodiment of the present disclosure, the acquired connection weights between the target neuron and the front-end neuron include a weight index and an effective weight value. After acquiring the weight index, the weight index and the output of the front-end neuron are ANDed, and the input data of the target neuron is calculated based on the result of the AND operation and the effective weight value.

[0081] Since the weight index is identification information corresponding one-to-one to the front-end neuron, each identification information is used to identify whether the connection weight between the front-end neuron and the target neuron corresponding to the identification information is zero. When the connection weight between the front-end neuron and the target neuron is zero, the corresponding identification information is also zero; the output of the front-end neuron is the value indicating the emission of the front-end neuron. When the front-end neuron does not emit to the target neuron, its output is zero.

[0082] The characteristic of the AND operation is that as long as one of the operations involved is zero, the result of the AND operation is zero. Therefore, when the result of the AND operation of the identification information corresponding to the front-end neuron and the output data is zero, it means that at least one of the connection weight between the front-end neuron and the target neuron and the output data of the front-end neuron is zero, that is, the emission information of the front-end neuron and the connection weight between the front-end neuron and the target neuron cannot participate in the calculation of the input data of the target neuron.

[0083] When the result of the AND operation is not zero, it means that the connection weight between the front-end neuron and the target neuron and the output data of the front-end neuron are not zero, that is, the emission information of the front-end neuron and the connection weight between the front-end neuron and the target neuron participate in the calculation of the input data of the target neuron.

[0084] For further optional reference, Figure 3 , in the weight index of the target neuron, each identification information is 1-bit data, 0 indicates that the connection weight between the front-end neuron corresponding to the identification information and the target neuron is zero, and 1 indicates that the connection weight between the front-end neuron corresponding to the identification information and the target neuron is not zero, the input of the target neuron is calculated according to the output of the front-end neuron of the target neuron, the identification information corresponding to the front-end neuron, and the connection weight between the front-end neuron and the target neuron (S201), including:

[0085] S301. When the result of an AND operation between the output data of the front-end neuron of the target neuron and the identification information corresponding to the front-end neuron is not zero, the input data of the target neuron is calculated according to the output data of the front-end neuron and the connection weight between the front-end neuron and the target neuron.

[0086] After obtaining the output data of the front-end neuron of the target neuron and obtaining the identification information corresponding to the front-end neuron from the weight index of the target neuron, the processing core ANDs the output data of the front-end neuron with the identification information corresponding to the front-end neuron (performs an AND operation).

[0087] If the result of the AND operation is not zero, it means that the output of the front-end neuron and the connection weight between the front-end neuron and the target neuron are not zero. Then the input data of the front-end neuron to the target neuron is calculated based on the output of the front-end neuron and the connection weight between the target neuron and the front-end neuron.

[0088] If the result of the AND operation is zero, it means that the output of the front-end neuron is zero or the connection weight between the front-end neuron and the target neuron is zero. The emission information of the front-end neuron and the connection weight between the front-end neuron and the target neuron cannot participate in the calculation of the input data of the target neuron.

[0089] Therefore, it is only necessary to calculate the input data of the target neuron based on the emission information of the corresponding front-end neurons whose AND results are not zero and the corresponding connection weights.

[0090] That is, the input data of the target neuron is calculated according to the output data of the front-end neuron and the connection weight between the front-end neuron and the target neuron, including:

[0091] The connection weight between the front-end neuron and the target neuron is obtained from the effective weight value of the target neuron, and the input data of the target neuron is calculated according to the output data of the front-end neuron and the connection weight between the front-end neuron and the target neuron.

[0092] That is, calculating the input data of the front-end neuron to the target neuron according to the output data of the front-end neuron and the connection weight between the target neuron and the front-end neuron includes: the processing core obtains the connection weight between the front-end neuron and the target neuron from the effective weight value of the target neuron, and calculates the input data of the target neuron according to the output data of all corresponding front-end neurons whose AND results are not zero and the connection weight between the target neuron and the front-end neuron.

[0093] Compared with the method in the related art, which calculates the input data of the target neuron according to the output data of each front-end neuron of the target neuron and the connection weight between the front-end neuron and the target neuron, the method for calculating the neuron input data of the neural network provided by the embodiment of the present disclosure is used to calculate the input data of the target neuron. First, through the AND operation of the index weight and the output data of the front-end neuron, the front-end neurons with a connection weight of zero with the target neuron and the front-end neurons with zero output data are excluded from the calculation of the input data of the target neuron, and the input data of the target neuron is calculated only through the remaining front-end neurons (that is, the connection weight with the target neuron is not zero and the output data is not zero), thereby reducing invalid calculations (the front-end neurons with a connection weight of zero with the target neuron or zero output data obviously do not contribute to the input data of the target neuron, and the calculation of the input data of the target neuron based on them is an invalid calculation), thereby saving system computing power.

[0094] Especially when the connection weight between the target neuron and multiple front-end neurons is zero, or the output data of multiple front-end neurons of the target neuron is zero, the method for calculating the neuron input data of the neural network provided by the embodiment of the present disclosure can greatly save system computing power, and the more the connection weight between the target neuron and the front-end neurons is zero, and the more the output data of the front-end neurons of the target neuron are zero, the more system computing power can be saved by using the method for calculating the neuron input data of the neural network provided by the embodiment of the present disclosure.

[0095] Figure 4 A schematic diagram of the connections of some neurons in a neural network.

[0096] Reference Figure 4 , A1, A2, A3, A4, B1, B2, B3 are neurons of a neural network (such as a pulse neural network), among which A1, A2, A3, A4 are connected with B1, B2, B3, and A1, A2, A3, A4 are the front-end neurons of B1, B2, B3.

[0097] Taking B1 as the neuron to be processed, its connection weights with A1 and A4 are non-zero values ​​(weight value 1 and weight value 2, respectively), and its connection weights with A2 and A3 are zero (or no connection weight). The process of storing the connection weights of B1 with A1, A2, A3, and A4 using a neural network connection weight storage method according to an embodiment of the present disclosure may be:

[0098] The processing core obtains the connection weight of B1 and A1. Since the connection weight of B1 and A1 is a non-zero value, the identification information corresponding to A1 is written into the weight index of B1. 0 is used to indicate that the connection weight of the front-end neuron corresponding to the identification information and the neuron to be processed is zero, and 1 is used to indicate that the connection weight of the front-end neuron corresponding to the identification information and the neuron to be processed is not zero. The identification information corresponding to A1 is 1. At the same time, the connection weight of B1 and A1 is written into the effective weight value of B1, that is, the weight value 1.

[0099] The processing core obtains the connection weight between B1 and A2. Since the connection weight between B1 and A2 is zero, the identification information corresponding to A2 written in the weight index of B1 is 0, and there is no need to write information in the effective weight value of B1.

[0100] The processing core obtains the connection weight between B1 and A2. Similar to A2, the connection weight between B1 and A3 is zero. The identification information corresponding to A3 written in the weight index of B1 is 0, and there is no need to write information in the effective weight value of B1.

[0101] The processing core obtains the connection weight of B1 and A4. Similar to A1, the connection weight of B1 and A4 is a non-zero value. The identification information corresponding to A4 written in the weight index of B1 is 1. At the same time, the connection weight of B1 and A4 is written in the effective weight value of B1, that is, the weight value 2.

[0102] Therefore, refer to Figure 5 , the weight index of B1 written into the storage space is 1001, and the effective weight values ​​are weight value 1 and weight value 2.

[0103] Taking B1 as the target neuron, when the emission information of A1, A2, A3, and A4 are 1, 0, 0, and 0 respectively, the process of calculating the input of B1 using the method for calculating neuron input data of a neural network provided by an embodiment of the present disclosure may be:

[0104] Since the issuance information of A1, A2, A3, and A4 are 1, 0, 0, and 0 respectively, the output data of A1, A2, A3, and A4 is also 1000, and the weight index corresponding to A1, A2, A3, and A4 is 1001. The output of A1, A2, A3, and A4 is ANDed with the weight index corresponding to A1, A2, A3, and A4, that is, 1000 and 1001 are ANDed, and the result is 1000, indicating that to calculate the input of B1, only the connection weight of A1 and B1 needs to be obtained.

[0105] The processing core only needs to obtain the connection weight between A1 and B1 (i.e., weight value 1), and calculate the input data of B1 according to weight value 1, perform accumulation operations, threshold issuance judgment and other operations.

[0106] If the release information of A1, A2, A3, and A4 are respectively -1, 1, 0, and 0, the process of calculating the input of B1 using the method for calculating neuron input data of a neural network provided by an embodiment of the present disclosure may be:

[0107] Since the release information of A1, A2, A3, and A4 are -1, 1, 0, and 0 respectively, the binary string corresponding to the output data of A1, A2, A3, and A4 is 110100, and the weight index corresponding to A1, A2, A3, and A4 is 1001. For the convenience of calculation, each bit is converted into a two-bit binary number, that is, 01000001. The output of A1, A2, A3, and A4 is ANDed with the weight index corresponding to A1, A2, A3, and A4, that is, 110100 and 01000001 are ANDed, and the result is 010000, indicating that to calculate the input of B1, it is only necessary to obtain the connection weight of A1 and B1.

[0108] Figure 6 A block diagram of a neural network connection weight storage device provided in an embodiment of the present disclosure.

[0109] Reference Figure 6 The embodiment of the present disclosure provides a neural network connection weight storage device 600, and the neural network connection weight storage device 600 includes:

[0110] The first module 601 is used to obtain the weight index of the neuron to be processed of the neural network, where the weight index of the neuron to be processed includes identification information corresponding to all front-end neurons of the neuron to be processed, and each identification information is used to indicate whether the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero;

[0111] The second module 602 is used to obtain the effective weight value of the neuron to be processed, where the effective weight value of the neuron to be processed includes the connection weights corresponding to all front-end neurons whose connection weights with the neuron to be processed are non-zero values;

[0112] The third module 603 is used to store the weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index.

[0113] Figure 7 A block diagram of the composition of a many-core system provided in an embodiment of the present disclosure.

[0114] Reference Figure 7 An embodiment of the present disclosure provides a many-core system, which includes multiple processing cores 701, an on-chip network 702, and a storage space 703.

[0115] Among them, multiple processing cores 701 are connected to the on-chip network 702, and the on-chip network 702 is used to exchange data between multiple processing cores and data stored in the storage space 703. The storage space 703 stores data stored using the above-mentioned neural network connection weight storage method.

[0116] Among them, one or more instructions are stored in one or more processing cores 701, and the one or more instructions are executed by one or more processing cores 701, so that one or more processing cores 701 can execute the above-mentioned method of calculating neuron input data of the neural network.

[0117] In addition, an embodiment of the present disclosure also provides a computer-readable medium on which a computer program is stored, wherein the computer program, when executed by a processing core, implements the above-mentioned method for storing neural network connection weights or the above-mentioned method for calculating neuron input data of the neural network.

[0118] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0119] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.

Claims

1. A method for calculating neuron input data of a neural network, wherein the neural network has at least one target neuron, the connection weight between the target neuron and the front-end neuron is stored using a preset neural network connection weight storage method, the connection weight between the target neuron and the front-end neuron includes a weight index, the weight index includes identification information corresponding to the front-end neurons of the target neuron one by one, each identification information indicates whether the connection weight between the front-end neuron corresponding to the identification information and the target neuron is zero, the method comprising: Calculating input data of the target neuron according to output data of a front-end neuron of the target neuron, identification information corresponding to the front-end neuron, and a connection weight between the front-end neuron and the target neuron; The output data of the front-end neuron of the target neuron includes the emission information of the front-end neuron; Wherein, the preset neural network connection weight storage method includes: Obtaining a weight index of a neuron to be processed of a neural network, wherein the weight index of the neuron to be processed includes identification information corresponding to all front-end neurons of the neuron to be processed, each identification information being used to indicate whether a connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero; Acquire the effective weight value of the neuron to be processed, where the effective weight value of the neuron to be processed includes the connection weights corresponding to all front-end neurons whose connection weights with the neuron to be processed are not zero; The weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index are stored.

2. The method for calculating neuron input data of a neural network according to claim 1, wherein: The step of calculating the input data of the target neuron according to the output data of the front-end neuron of the target neuron, the identification information corresponding to the front-end neuron, and the connection weight between the front-end neuron and the target neuron includes: The input data of the target neuron is calculated according to the AND operation result of the output data of the front-end neuron of the target neuron and the identification information corresponding to the front-end neuron, and the connection weight between the front-end neuron and the target neuron.

3. The method for calculating neuron input data of a neural network according to claim 1, wherein: In the case where each identification information is 1-bit data, 0 indicates that the connection weight between the front-end neuron corresponding to the identification information and the target neuron is zero, and 1 indicates that the connection weight between the front-end neuron corresponding to the identification information and the target neuron is not zero, the input data of the target neuron is calculated according to the output data of the front-end neuron of the target neuron, the identification information corresponding to the front-end neuron, and the connection weight between the front-end neuron and the target neuron, including: When the result of an AND operation between the output data of the front-end neuron of the target neuron and the identification information corresponding to the front-end neuron is not zero, the input data of the target neuron is calculated based on the output data of the front-end neuron and the connection weight between the front-end neuron and the target neuron.

4. The method for calculating neuron input data of a neural network according to claim 3, wherein: The neural network is a pulse neural network, and the input data of the target neuron is calculated according to the output data of the front-end neuron and the connection weight between the front-end neuron and the target neuron, including: The connection weight between the front-end neuron and the target neuron is obtained from the effective weight value of the target neuron, and the input data of the target neuron is calculated according to the output data of the front-end neuron and the connection weight between the front-end neuron and the target neuron.

5. The calculation method according to claim 1, wherein: The neural network is a neural network loaded on a many-core system, and the weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index are stored, including: The weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index are stored in an external storage space outside the many-core system.

6. The calculation method according to claim 1, wherein: The neural network is a neural network loaded on a many-core system, and the weight index of the neuron to be processed and the effective weight value corresponding to the order of the identification information in the weight index are stored, including: The weight index of the neuron to be processed and the valid weight value corresponding to the order of identification information in the weight index are stored in the on-chip storage space of the many-core system.

7. The calculation method according to claim 1, wherein: Each identification information is 1-bit data, 0 indicates that the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is zero, and 1 indicates that the connection weight between the front-end neuron corresponding to the identification information and the neuron to be processed is not zero.

8. A device for calculating neuron input data of a neural network, used for executing the method according to any one of claims 1 to 7.

9. A many-core system, comprising: A plurality of processing cores, at least some of the processing cores having neurons, and the neurons on the plurality of processing cores forming a neural network; A storage space on which data stored using the neural network connection weight storage method according to any one of claims 1 to 8 is stored; An on-chip network configured to exchange data between the plurality of processing cores and data stored in the storage space; One or more instructions are stored in one or more of the processing cores, and one or more of the instructions are executed by one or more of the processing cores so that one or more of the processing cores can execute the method for calculating neuron input data of a neural network as described in any one of claims 1-8.

10. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by the processing core, the computer program implements the method for calculating neuron input data of a neural network according to any one of claims 1 to 8.