CN117313806A - Neural network training method, device, equipment and storage medium - Google Patents

Neural network training method, device, equipment and storage medium Download PDF

Info

Publication number
CN117313806A
CN117313806A CN202311470297.3A CN202311470297A CN117313806A CN 117313806 A CN117313806 A CN 117313806A CN 202311470297 A CN202311470297 A CN 202311470297A CN 117313806 A CN117313806 A CN 117313806A
Authority
CN
China
Prior art keywords
neural network
memory
training
trained
network training
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311470297.3A
Other languages
Chinese (zh)
Inventor
党鹏
王伟
李阳
姜文峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peng Cheng Laboratory
Original Assignee
Peng Cheng Laboratory
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peng Cheng Laboratory filed Critical Peng Cheng Laboratory
Priority to CN202311470297.3A priority Critical patent/CN117313806A/en
Publication of CN117313806A publication Critical patent/CN117313806A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a neural network training method, device, equipment and storage medium. The neural network training method is applied to a neural network training system, the neural network training system comprises a CAM circuit and a memory array, and the neural network training method comprises the following steps: acquiring training phase information of a neural network to be trained, and determining a memory calculation mode according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a reverse propagation mode; generating a control signal of the CAM circuit according to the memory calculation mode; and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained based on the control signal. The method can realize the bidirectional configuration of the data flow in the neural network training process, finish the calculation acceleration of the forward propagation and the backward propagation of the neural network, and improve the model training efficiency.

Description

Neural network training method, device, equipment and storage medium
Technical Field
The present invention relates to the field of model training technologies, and in particular, to a neural network training method, device, equipment, and storage medium.
Background
The neural network weight parameters are mapped in the nonvolatile memory array, and by applying different input signals to the memory array, the efficient dot product calculation can be realized by utilizing the principles of kirchhoff's law and ohm's law. The new calculation paradigm can greatly accelerate model calculation, reduce the cost of data transmission and reduce the calculation energy consumption. However, in the existing integrated computational architecture based on the RRAM and other novel nonvolatile memories, the input and output ends formed by the peripheral circuits cannot realize bidirectional configuration of data, so that the forward computation of the neural network can be accelerated, and the application scene of the integrated computational technology is greatly limited. In addition, due to the limitation of the hardware architecture which can only carry out forward propagation calculation, when online learning is carried out, only forward calculation in the training process can be accelerated, and backward propagation and weight updating calculation are required to be carried out on other calculation platforms.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The invention mainly aims to provide a neural network training method, device, equipment and storage medium, and aims to solve the technical problem that in the prior art, feedback calculation of a neural network is not supported in the process of training the neural network by utilizing an AI accelerator of a RRAM (remote radio access memory) and other novel memories, so that training efficiency of a neural network model is low.
In order to achieve the above object, the present invention provides a neural network training method applied to a neural network training system including a CAM circuit and a memory array, the neural network training method comprising the steps of:
acquiring training phase information of a neural network to be trained, and determining a memory calculation mode according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a reverse propagation mode;
generating a control signal of the CAM circuit according to the memory calculation mode;
and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained based on the control signal.
Optionally, the CAM circuit includes a transfer gate connected with the memory array;
the step of controlling the data flow direction of the target data in the memory array in the training process of the neural network to be trained based on the control signal comprises the following steps:
controlling a switching state of the transmission gate in the CAM circuit based on the control signal;
and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained according to the switch state.
Optionally, the control signal comprises a forward propagating signal and a backward propagating signal;
the step of controlling the data flow direction of the target data in the memory array in the training process of the neural network to be trained based on the control signal comprises the following steps:
when the control signal is a forward propagation signal, the data flow direction of target data in the memory array in the training process of the neural network to be trained is a feedforward direction so as to perform feedforward calculation of the neural network to be trained;
and when the control signal is a counter-propagating signal, the data flow direction of the target data in the memory array in the training process of the neural network to be trained is a feedback direction so as to perform feedback calculation of the neural network to be trained.
Optionally, the step of performing feedback calculation of the neural network to be trained includes:
determining an error term of the feedback calculation;
determining a voltage vector corresponding to the feedback calculation according to the error term;
and carrying out feedback calculation on the neural network to be trained according to the data flow direction of the feedback direction based on the voltage vector and the memory array.
Optionally, the forward propagation mode and the backward propagation mode share a set of input-output circuits.
Optionally, the memory array comprises a resistive memory, a phase change memory, a magnetic memory, or a ferroelectric memory.
Optionally, the neural network training system comprises two sets of input and output circuits, wherein the input and output circuits are respectively used for performing feedforward calculation and feedback calculation of the neural network training.
In addition, to achieve the above object, the present invention also provides a neural network training device, including:
the acquisition module is used for acquiring training phase information of the neural network to be trained, and determining a memory calculation mode according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a reverse propagation mode;
the generation module is used for generating a control signal of the CAM circuit according to the memory calculation mode;
and the data flow control module is used for controlling the data flow of the target data in the memory array in the training process of the neural network to be trained based on the control signal.
In addition, to achieve the above object, the present invention also proposes a neural network training device, the device comprising: a memory, a processor, and a neural network training program stored on the memory and executable on the processor, the neural network training program configured to implement the steps of the neural network training method as described above.
In addition, to achieve the above object, the present invention also proposes a storage medium having stored thereon a neural network training program which, when executed by a processor, implements the steps of the neural network training method as described above.
The neural network training method is applied to a neural network training system, the neural network training system comprises a CAM circuit and a memory array, and the neural network training method comprises the following steps: acquiring training phase information of a neural network to be trained, and determining a memory calculation mode according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a reverse propagation mode; generating a control signal of the CAM circuit according to the memory calculation mode; and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained based on the control signal. According to the method, the control signal of the CAM circuit is generated according to the memory calculation mode, the data flow direction of the target data in the memory array in the training process of the neural network to be trained is controlled based on the control signal, the bidirectional configuration of the data flow in the training process of the neural network can be realized, the calculation acceleration of the forward propagation and the backward propagation of the neural network is completed, and the model training efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of a neural network training device of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart of a neural network training method according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram of a neural network acceleration calculation data flow direction according to a first embodiment of the neural network training method of the present invention;
FIG. 4 is a schematic diagram of a neural network feedback calculation data flow according to a first embodiment of the neural network training method of the present invention;
FIG. 5 is a schematic diagram of a memory architecture for configurable data flow direction according to a first embodiment of the neural network training method of the present invention;
FIG. 6 is a schematic diagram of a CAM circuit according to a first embodiment of the neural network training method of the present invention;
FIGS. 7-8 are schematic data flow diagrams illustrating a neural network training method according to a first embodiment of the present invention;
FIG. 9 is a flowchart of a neural network training method according to a second embodiment of the present invention;
FIG. 10 is a schematic diagram of two sets of input/output circuits according to a second embodiment of the neural network training method of the present invention;
fig. 11 is a block diagram of a neural network training device according to a first embodiment of the present invention.
Reference numerals illustrate:
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a neural network training device in a hardware running environment according to an embodiment of the present invention.
As shown in fig. 1, the neural network training device may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., a wireless-Fidelity (WI-FI) interface). The Memory 1005 may be a high-speed random access Memory (Ran dom Access Memory, RAM) or a stable nonvolatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the structure shown in fig. 1 is not limiting of the neural network training device and may include more or fewer components than shown, or may combine certain components, or may be a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a neural network training program may be included in the memory 1005 as one type of storage medium.
In the neural network training device shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the neural network training device of the present invention may be provided in the neural network training device, and the neural network training device invokes the neural network training program stored in the memory 1005 through the processor 1001 and executes the neural network training method provided by the embodiment of the present invention.
Based on the neural network training device, an embodiment of the present invention provides a neural network training method, and referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the neural network training method of the present invention.
In this embodiment, the neural network training method is applied to a neural network training system, where the neural network training system includes a CAM circuit and a memory array, and the neural network training method includes the following steps:
step S10: training phase information of the neural network to be trained is obtained, and a memory calculation mode is determined according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a backward propagation mode.
It should be noted that, the execution body of the embodiment may be a computing service device with functions of data processing, network communication and program running, such as a mobile phone, a tablet computer, a personal computer, or an electronic device or a neural network training system capable of implementing the above functions. This embodiment and the following embodiments will be described below by taking the neural network training system as an example.
It should be appreciated that the computation of the neural network is primarily a parameter-intensive operation that is dominated by matrix-vector products, where matrix-vector product operations traverse forward propagation, backward propagation and weight update phases. Referring to fig. 3, fig. 3 is a schematic diagram of a neural network acceleration calculation data flow direction according to a first embodiment of the neural network training method of the present invention; currently, the direction of data flow in a memory architecture based on RRAM neotype memory is shown in FIG. 3, i.e., from the input peripheral circuit through the RRAM neotype memory array to the output peripheral circuit. The method maps the input vector into the voltage vector, inputs the voltage vector into the RRAM cross array, and can obtain the operation result of the matrix vector product at the output end, and the physical principles of the calculation process are ohm's law and kirchhoff's law. However, since the direction of data flow can only enable feed-forward computation, the architecture of fig. 3 clearly cannot compute other computations of the neural network, which limits the application scenarios and potential of the computational integration technique.
Therefore, in order to mine the potential of the RRAM calculation unit, the present embodiment proposes a concept that makes the data flow direction back-propagating, so as to complete the feedback calculation of the neural network. Referring to fig. 4, fig. 4 is a schematic diagram of a neural network feedback calculation data flow according to a first embodiment of the neural network training method of the present invention; and (3) inputting signals at the other end of the array, and mapping the residual errors in the back propagation calculation process in a voltage vector mode, so that the residual error of the upper layer can be obtained at the other end. Based on such a concept, this embodiment proposes an intelligent gating switch circuit capable of customizing an acceleration mode (Custom Acceleration Mode, CAM), namely the CAM circuit, wherein the CAM circuit can share a set of input/output circuits through a controller, and referring to fig. 5, fig. 5 is a schematic diagram of a storage-calculation integrated architecture of a configurable data flow direction of a first embodiment of the neural network training method of the present invention; the G11-Gij matrix in FIG. 5 is the memory array, and CAM circuitry is provided on the periphery of the memory array for configuring the data flow direction.
It should be noted that the forward propagation mode and the backward propagation mode correspond to a feedforward calculation and a feedback calculation of the neural network to be trained, respectively. The forward propagation mode and the backward propagation mode share a set of input-output circuits. If the training phase information is that the neural network to be trained needs to perform feedback calculation, the memory calculation mode is a back propagation mode, and if the training phase information is that the neural network to be trained needs to perform feedforward calculation, the memory calculation mode is a forward propagation mode.
Step S20: and generating a control signal of the CAM circuit according to the memory calculation mode.
It should be noted that, the CAM circuit includes a plurality of transmission gates, where the transmission gates are connected to the memory array, and by controlling the on-off states of the transmission gates in the CAM circuit, the data flow of the data flow in the memory array in the training process of the neural network model can be realized. The generating the control signal of the CAM circuit according to the memory computation mode may be generating a forward propagation signal when the memory computation mode is a forward propagation mode, where the forward propagation signal is used to control a data stream to propagate forward in the memory array, so as to implement feedforward computation of a neural network model. And when the memory calculation mode is a back propagation mode, generating a back propagation signal, wherein the back propagation signal is used for controlling the data flow to back propagate in the memory array so as to realize feedback calculation of the neural network model.
Step S30: and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained based on the control signal.
It should be noted that, the target data may be data in a training process of the neural network to be trained, and in the feedforward calculation, the target data may be a voltage vector corresponding to the sample data; in the feedback calculation, the target data may be a voltage vector corresponding to the error term. The controlling the data flow direction of the target data in the memory array in the training process of the neural network to be trained based on the control signal may be controlling the switch state of the transmission gate in the CAN circuit according to the control signal, and controlling the data flow direction of the target data in the memory array in the training process of the neural network to be trained according to the switch state of the transmission gate.
In specific implementation, reference may be made to fig. 6, and fig. 6 is a schematic diagram of a CAM circuit according to a first embodiment of the neural network training method of the present invention; in the circuit diagram shown in FIG. 6, coThe ntroller receives a control signal to control the RRAM memory cell (i.e., the memory array), for example, cam= "1" may be defined as a feed-forward mode, and cam= "0" may be defined as a counter-propagating mode. Based on this, when cam= "1" in the control signal, the transfer gate T in fig. 6 B1 ,T B2 ,……,T Bk ,……,T Bi And T S1 ,T S2 ,……,T Sm ,……,T Sj Gating, at this time, transmission gateAnd-> At this time, the flow of data on the memory array is shown by the arrow in fig. 7, and fig. 7 is a schematic diagram of the flow of data according to the first embodiment of the neural network training method of the present invention. When cam= "0", the transfer gate T in fig. 6 B1 ,T B2 ,……,T Bk ,……,T Bi And T S1 ,T S2 ,……,T Sm ,……,T Sj Closing, at this time, transmission gate->And gating, in which the data flow on the memory array is shown by the arrows in FIG. 8, FIG. 8 is a schematic diagram of the data flow of the first embodiment of the neural network training method of the present invention
Further, the memory cells of the memory array are not limited to the cross array formed by the storage medium such as the resistive random access memory (Resistiv e Random Access Memory, RRAM), the magnetic random access memory (Magnetoresistive Ran dom Access Memory, MRAM), the phase change random access memory (Phase Change Random Access Memory, PCRAM), the Ferroelectric memory (FeFET), and the like, and the same effects can be achieved. The application object of the neural network training method provided in this embodiment is not limited to the deep neural network (Deep Neural Net works, DNN) mentioned in the description, but can be applied to a plurality of neural networks such as a multi-layer perceptron (Multilayer Perceptron, MLP), a convolutional neural network (Convolutional Neural Network, CNN), a Long short-Term Memory (LSTM) neural network, a feedback neural network (Recurrent Neural Net work, RNN), a reinforcement learning (Reinforcement Learning) network, a transducer, and the like. The neural networks can be used in a plurality of different application scenarios, such as image recognition, voice recognition, natural language processing, automatic driving and the like.
The method comprises the steps of obtaining training phase information of a neural network to be trained, and determining a memory calculation mode according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a reverse propagation mode; generating a control signal of the CAM circuit according to the memory calculation mode; and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained based on the control signal. According to the method, the control signal of the CAM circuit is generated according to the memory calculation mode, the data flow direction of the target data in the memory array in the training process of the neural network to be trained is controlled based on the control signal, the bidirectional configuration of the data flow in the training process of the neural network can be realized, the calculation acceleration of the forward propagation and the backward propagation of the neural network is completed, and the model training efficiency is improved.
According to the embodiment, an innovative circuit design scheme is introduced into a memory array formed by a novel memory such as a Resistive Random Access Memory (RRAM), the basis is adopted in a data calculation mode in the training process of a neural network, the data is fully adapted to hardware, and a gating switch circuit (namely a CAM circuit) is introduced to perform bidirectional configuration of data flow. The circuitry may be instructed by a user or computer to specify whether the direction of the data stream is forward or backward propagating. In the circuit design, the gating switch circuit is formed by a transmission gate with limited energy consumption and area cost, not only bidirectional configuration of data flow is realized, but also multiplexing of peripheral circuits is realized, and forward and backward propagation calculation of a neural network can be realized by only one set of input/output circuit. This implementation makes the application scenario of the AI accelerator based on the new memory configuration such as RRAM more possible. Besides small computing platforms such as end sides and edge sides, the method also provides a candidate on the construction scheme of large computing platforms.
Referring to fig. 9, fig. 9 is a flowchart of a neural network training method according to a second embodiment of the present invention.
Based on the first embodiment described above, in this embodiment, the control signal includes a forward propagating signal and a backward propagating signal, and the step S30 includes:
step S301: and when the control signal is a forward propagation signal, the data flow direction of target data in the memory array in the training process of the neural network to be trained is a feedforward direction so as to perform feedforward calculation of the neural network to be trained.
Step S302: and when the control signal is a counter-propagating signal, the data flow direction of the target data in the memory array in the training process of the neural network to be trained is a feedback direction so as to perform feedback calculation of the neural network to be trained.
It should be noted that, the feedforward direction may be a data flow direction of the neural network feedforward calculation process to be trained. Reference may be made to fig. 7. The feedback direction may be a data flow direction of a neural network feedback calculation process to be trained. Reference is made to fig. 8. The step of performing feedback calculation of the neural network to be trained comprises the following steps:
determining an error term of the feedback calculation;
determining a voltage vector corresponding to the feedback calculation according to the error term;
and carrying out feedback calculation on the neural network to be trained according to the data flow direction of the feedback direction based on the voltage vector and the memory array.
It should be noted that, the determining the voltage vector corresponding to the feedback calculation according to the error term may be mapping the error term to a voltage vector. Determining the error term for the feedback calculation may specifically include: calculating the forward propagation process of the neural network to obtain the activation value of each layer:
a (0) =x
wherein a is used in the present embodiment (l) The activation value characterizing layer i, x is used to characterize the input sample.
For each layer L from 1 to L, the following steps are performed:
calculating weighted input:
z (l) =W (1-1) a (l-1) +b (l-1)
calculating an activation value:
a (1) =g(z (1) )
wherein g (z) (l) ) Is an activation function, and nonlinear functions such as Sigmoid, reLU and the like are generally used. z (l) Weighted input for characterizing layer I, W (1 ) Weight matrix for characterizing layers l to l+1, b (l) And the deviation vector is used for representing the first layer.
Calculate the error of the output layer (gradient of the loss function with respect to the output activation value):
wherein,is the gradient of the loss function J with respect to the output activation value a (L), by which is meant the element-wise multiplication, g' (z) (L) ) Is the derivative of the activation function of the output layer.
Back propagation error (Backpropagation of Error): starting from the output layer L, the error is propagated forward layer by layer, for each hidden layer l=l-1 to 2, the error term δ is calculated (1)
δ (1) =(W (l) ) T δ (l+1) ⊙g′(z (l) )
Wherein delta (l) The error term used to characterize the first layer.
In implementations, the weights and biases may be updated using a gradient descent or other optimization algorithm, and the iteration repeated until the loss function converges or reaches a predetermined training round. Through the back propagation algorithm, the deep neural network can learn how to adjust weights and bias to minimize the loss function, thereby achieving better prediction and classification performance. Wherein, the weight and deviation are calculated as follows:
where α is the learning rate, the step size used to control the weight and bias updates. W (W) (l) Weight matrix for characterizing layers l to 1+1, b (l) And the deviation vector is used for representing the first layer.
Furthermore, to realize bidirectional configuration of data flow, two sets of input and output circuits are used, and configuration is performed by CAM circuit modules, as shown in fig. 10, fig. 10 is a schematic diagram of two sets of input and output circuits in the second embodiment of the neural network training method of the present invention; but this approach is costly because of the two sets of peripheral circuitry.
In this embodiment, when the control signal is a forward propagation signal, a data flow direction of target data in the memory array in the training process of the neural network to be trained is a feedforward direction, so as to perform feedforward calculation of the neural network to be trained. And when the control signal is a counter-propagating signal, the data flow direction of the target data in the memory array in the training process of the neural network to be trained is a feedback direction so as to perform feedback calculation of the neural network to be trained. The embodiment can realize the bidirectional configuration of the calculation data flow, can realize the back propagation acceleration calculation of the neural network, and greatly expands the application scene of the memory calculation integrated system based on the novel memory.
Referring to fig. 11, fig. 11 is a block diagram illustrating a neural network training device according to a first embodiment of the present invention.
As shown in fig. 11, the neural network training device according to the embodiment of the present invention includes:
the acquisition module 10 is configured to acquire training phase information of a neural network to be trained, and determine a memory calculation mode according to the training phase information, where the memory calculation mode includes a forward propagation mode and a backward propagation mode;
a generating module 20, configured to generate a control signal of the CAM circuit according to the memory calculation mode;
and the data flow control module 30 is used for controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained based on the control signals.
The method comprises the steps of obtaining training phase information of a neural network to be trained, and determining a memory calculation mode according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a reverse propagation mode; generating a control signal of the CAM circuit according to the memory calculation mode; and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained based on the control signal. According to the method, the control signal of the CAM circuit is generated according to the memory calculation mode, the data flow direction of the target data in the memory array in the training process of the neural network to be trained is controlled based on the control signal, the bidirectional configuration of the data flow in the training process of the neural network can be realized, the calculation acceleration of the forward propagation and the backward propagation of the neural network is completed, and the model training efficiency is improved.
It should be noted that the above-described working procedure is merely illustrative, and does not limit the scope of the present invention, and in practical application, a person skilled in the art may select part or all of them according to actual needs to achieve the purpose of the embodiment, which is not limited herein.
In addition, technical details not described in detail in this embodiment may refer to the neural network training method provided in any embodiment of the present invention, which is not described herein.
Based on the first embodiment of the neural network training device of the present invention, a second embodiment of the neural network training device of the present invention is provided.
In this embodiment, the CAM circuit includes a transfer gate that is connected to the memory array; the data flow control module 30 is further configured to control a switching state of the transmission gate in the CAM circuit based on the control signal;
and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained according to the switch state.
Further, the control signal includes a forward propagating signal and a backward propagating signal; the data flow direction control module 30 is further configured to perform feedforward calculation of the neural network to be trained when the control signal is a forward propagation signal and the data flow direction of the target data in the memory array in the training process of the neural network to be trained is a feedforward direction.
Step S302: and when the control signal is a counter-propagating signal, the data flow direction of the target data in the memory array in the training process of the neural network to be trained is a feedback direction so as to perform feedback calculation of the neural network to be trained.
Further, the data flow control module 30 is further configured to determine an error term of the feedback calculation;
determining a voltage vector corresponding to the feedback calculation according to the error term;
and carrying out feedback calculation on the neural network to be trained according to the data flow direction of the feedback direction based on the voltage vector and the memory array.
Further, the forward propagation mode and the backward propagation mode share a set of input-output circuits.
Further, the memory array includes a resistive memory, a phase change memory, a magnetic random access memory, or a ferroelectric memory.
Furthermore, the neural network training system comprises two sets of input and output circuits, wherein the input and output circuits are respectively used for performing feedforward calculation and feedback calculation of the neural network training.
Other embodiments or specific implementations of the neural network training device of the present invention may refer to the above method embodiments, and are not described herein.
In addition, the embodiment of the invention also provides a storage medium, and the storage medium stores a neural network training program, and the neural network training program realizes the steps of the neural network training method when being executed by a processor.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. read-only memory/random-access memory, magnetic disk, optical disk), comprising signals for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. A neural network training method, wherein the neural network training method is applied to a neural network training system, the neural network training system comprising a CAM circuit and a memory array, the neural network training method comprising the steps of:
acquiring training phase information of a neural network to be trained, and determining a memory calculation mode according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a reverse propagation mode;
generating a control signal of the CAM circuit according to the memory calculation mode;
and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained based on the control signal.
2. The neural network training method of claim 1, wherein the CAM circuit includes a transmission gate, the transmission gate being coupled to the memory array;
the step of controlling the data flow direction of the target data in the memory array in the training process of the neural network to be trained based on the control signal comprises the following steps:
controlling a switching state of the transmission gate in the CAM circuit based on the control signal;
and controlling the data flow direction of target data in the memory array in the training process of the neural network to be trained according to the switch state.
3. The neural network training method of claim 1, wherein the control signals include forward propagating signals and backward propagating signals;
the step of controlling the data flow direction of the target data in the memory array in the training process of the neural network to be trained based on the control signal comprises the following steps:
when the control signal is a forward propagation signal, the data flow direction of target data in the memory array in the training process of the neural network to be trained is a feedforward direction so as to perform feedforward calculation of the neural network to be trained;
and when the control signal is a counter-propagating signal, the data flow direction of the target data in the memory array in the training process of the neural network to be trained is a feedback direction so as to perform feedback calculation of the neural network to be trained.
4. The neural network training method of claim 3, wherein the step of performing feedback calculations for the neural network to be trained comprises:
determining an error term of the feedback calculation;
determining a voltage vector corresponding to the feedback calculation according to the error term;
and carrying out feedback calculation on the neural network to be trained according to the data flow direction of the feedback direction based on the voltage vector and the memory array.
5. The neural network training method of any of claims 1-4, wherein the forward propagating mode and the backward propagating mode share a set of input-output circuits.
6. The neural network training method of any of claims 1-4, wherein the memory array includes a resistive memory, a phase change memory, a magneto-random access memory, or a ferroelectric memory.
7. The neural network training method of any of claims 1-4, wherein the neural network training system includes two sets of input-output circuits for performing feedforward and feedback calculations, respectively, of the neural network training.
8. A neural network training device, characterized in that the neural network training device comprises:
the acquisition module is used for acquiring training phase information of the neural network to be trained, and determining a memory calculation mode according to the training phase information, wherein the memory calculation mode comprises a forward propagation mode and a reverse propagation mode;
the generation module is used for generating a control signal of the CAM circuit according to the memory calculation mode;
and the data flow control module is used for controlling the data flow of the target data in the memory array in the training process of the neural network to be trained based on the control signal.
9. A neural network training device, the device comprising: a memory, a processor, and a neural network training program stored on the memory and executable on the processor, the neural network training program configured to implement the steps of the neural network training method of any of claims 1 to 7.
10. A storage medium having stored thereon a neural network training program which when executed by a processor performs the steps of the neural network training method of any of claims 1 to 7.
CN202311470297.3A 2023-11-06 2023-11-06 Neural network training method, device, equipment and storage medium Pending CN117313806A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311470297.3A CN117313806A (en) 2023-11-06 2023-11-06 Neural network training method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311470297.3A CN117313806A (en) 2023-11-06 2023-11-06 Neural network training method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117313806A true CN117313806A (en) 2023-12-29

Family

ID=89237434

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311470297.3A Pending CN117313806A (en) 2023-11-06 2023-11-06 Neural network training method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117313806A (en)

Similar Documents

Publication Publication Date Title
US10740671B2 (en) Convolutional neural networks using resistive processing unit array
Pérez-Sánchez et al. A review of adaptive online learning for artificial neural networks
US9779355B1 (en) Back propagation gates and storage capacitor for neural networks
KR102672586B1 (en) Artificial neural network training method and device
US8694451B2 (en) Neural network system
CN110674933A (en) Pipeline technique for improving neural network inference accuracy
Yang et al. Online sequential echo state network with sparse RLS algorithm for time series prediction
JP6092477B2 (en) An automated method for correcting neural dynamics
US11087204B2 (en) Resistive processing unit with multiple weight readers
CN109523014B (en) News comment automatic generation method and system based on generative confrontation network model
CN110428042B (en) Reciprocally scaling neuron connection weights and input values to defeat hardware limitations
US20200293855A1 (en) Training of artificial neural networks
US20210374546A1 (en) Row-by-row convolutional neural network mapping for analog artificial intelligence network training
CN114037047A (en) Training method of impulse neural network
KR102396447B1 (en) Deep learning apparatus for ANN with pipeline architecture
Dai et al. Alleviating the problem of local minima in Backpropagation through competitive learning
Greenberg-Toledo et al. Supporting the momentum training algorithm using a memristor-based synapse
CN108734270B (en) Compatible neural network accelerator and data processing method
US11868893B2 (en) Efficient tile mapping for row-by-row convolutional neural network mapping for analog artificial intelligence network inference
CN117313806A (en) Neural network training method, device, equipment and storage medium
CN113625560A (en) Loss rate control method and device for corn harvester, storage medium and equipment
US20240202505A1 (en) Monostable Multivibrators-based Spiking Neural Network Training Method
KR102505043B1 (en) Device performing AI inference through quantization and batch folding
US20240220573A1 (en) Computing in Memory Accelerator for Applying to a Neural Network
US20210142153A1 (en) Resistive processing unit scalable execution

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination