CN111737193B - Data storage method, device, equipment and storage medium - Google Patents

Data storage method, device, equipment and storage medium Download PDF

Info

Publication number
CN111737193B
CN111737193B CN202010764719.8A CN202010764719A CN111737193B CN 111737193 B CN111737193 B CN 111737193B CN 202010764719 A CN202010764719 A CN 202010764719A CN 111737193 B CN111737193 B CN 111737193B
Authority
CN
China
Prior art keywords
data
neural network
calculation
calculated
type
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.)
Active
Application number
CN202010764719.8A
Other languages
Chinese (zh)
Other versions
CN111737193A (en
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.)
Shenzhen Corerain Technologies Co Ltd
Original Assignee
Shenzhen Corerain Technologies Co Ltd
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 Shenzhen Corerain Technologies Co Ltd filed Critical Shenzhen Corerain Technologies Co Ltd
Priority to CN202010764719.8A priority Critical patent/CN111737193B/en
Publication of CN111737193A publication Critical patent/CN111737193A/en
Application granted granted Critical
Publication of CN111737193B publication Critical patent/CN111737193B/en
Priority to PCT/CN2021/106394 priority patent/WO2022028224A1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/76Architectures of general purpose stored program computers
    • G06F15/82Architectures of general purpose stored program computers data or demand driven
    • G06F15/825Dataflow computers
    • 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/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Neurology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention discloses a data storage method, a data storage device, data storage equipment and a data storage medium. The data storage method comprises the following steps: acquiring first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data; configuring a first preset rule based on the first neural network calculation type; storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network; the first data to be calculated flows in the data flow network according to a preset data flow. The effect of storing and sending data of different network computing types to the computing module for computing according to different storage modes is achieved by configuring corresponding preset rules according to the neural network computing types.

Description

Data storage method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of neural networks, for example, to a data storage method, device, equipment and storage medium.
Background
With the rapid development of the neural network technology, the calculation data volume of the neural network is larger and larger, and the data storage is an important content of the neural network technology.
At present, a neural network chip developed based on a data flow architecture generally includes a plurality of network levels, a structure type of each layer is referred to as a network computing type of each layer, network computing types between different layers may be different, and computing data of a neural network generally corresponds to the network computing type, so that, under the condition that a computing module is fixed, the neural network chip needs to adopt different data storage modes for different network computing types. Generally, data and parameters of a data flow architecture chip are directly and sequentially read out to be used by a subsequent computing module after being carried from off-chip storage to on-chip storage, that is, external software is required to arrange the data and transmit the data to the chip in a good sequence.
However, in the chip adopting the data flow architecture, the above-mentioned method cannot flexibly support multiple types of networks, if the network calculation parameters are changed, the chip can only support the corresponding network calculation types by supplementing data and increasing the calculation amount, which reduces the calculation efficiency of the chip, and once the external real-time data is changed, the calculation requirements cannot be met.
Disclosure of Invention
Embodiments of the present invention provide a data storage method, an apparatus, a device, and a storage medium, so as to achieve the effect of storing and calculating data of different network calculation types of a data stream architecture chip in different storage modes.
In a first aspect, an embodiment of the present invention provides a storage method of a neural network computing type, including:
acquiring first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data;
configuring a first preset rule based on the first neural network calculation type;
storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network;
the first data to be calculated flows in the data flow network according to a preset data flow.
Optionally, after the storing the first to-be-calculated data based on the first preset rule, the method further includes:
acquiring second data to be calculated of a second layer of a neural network and a second neural network calculation type corresponding to the second data to be calculated;
judging whether the first neural network calculation type is the same as the second neural network calculation type;
responding to a judgment result that the first neural network computing type is the same as the second neural network computing type, and storing the second data to be computed based on the first preset rule;
and responding to a judgment result that the first neural network computing type is different from the second neural network computing type, configuring a second preset rule based on the second neural network computing type, and storing the second data to be computed based on the second preset rule, so that the second data to be computed is sent to a computing module in the data flow network for computation according to a second data sequence matched with the second neural network computing type.
Optionally, the first preset rule includes a preset storage rule and a preset calculation rule;
the storing the first to-be-calculated data based on the first preset rule includes:
storing the first data to be calculated based on the preset storage rule, wherein the preset storage rule is a rule for storing the first data to be calculated according to the first data sequence;
after the configuring the first preset rule based on the first neural network computation type, further comprising: and transmitting the preset calculation rule to a calculation module so that the calculation module can calculate the first data to be calculated according to the preset calculation rule, wherein the preset calculation rule is a rule calculated according to the calculation type of the first neural network.
Optionally, the first data to be calculated includes at least one calculation parameter, and the second data to be calculated includes at least one calculation parameter.
Optionally, calculating the parameter includes: convolution kernel size kernel, step size stride, convolution kernel channel, and filter.
Optionally, the storing the first to-be-calculated data based on the preset storage rule includes:
and storing the first data to be calculated to an on-chip memory according to the first data sequence based on the preset storage rule, and transmitting the first data to be calculated to the calculation module after the first data to be calculated is sequenced according to the first data sequence through the on-chip memory.
In a second aspect, an embodiment of the present invention provides a storage device of a neural network computing type, including:
the acquisition module is used for acquiring first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data;
the configuration module is used for configuring a first preset rule based on the first neural network calculation type;
the on-chip storage module is used for storing the first to-be-calculated data based on the first preset rule so that the first to-be-calculated data are sent to the calculation module in the data flow network for calculation according to the first data sequence matched with the calculation type of the first neural network;
the first data to be calculated flows in the data flow network according to a preset data flow.
Optionally, the obtaining module is further configured to obtain second data to be calculated of a second layer of the neural network and a second neural network calculation type corresponding to the second data to be calculated;
the device further comprises: the judging module is used for judging whether the first neural network calculation type is the same as the second neural network calculation type;
the on-chip storage module is further used for responding to a judgment result that the first neural network computing type is the same as the second neural network computing type, and storing the second data to be computed based on the first preset rule; and responding to a judgment result that the first neural network computing type is different from the second neural network computing type, configuring a second preset rule based on the second neural network computing type, and storing the second data to be computed based on the second preset rule, so that the second data to be computed is sent to a computing module in the data flow network for computation according to a second data sequence matched with the second neural network computing type.
In a third aspect, an embodiment of the present invention provides an apparatus, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a neural network computing-type storage method as described in any embodiment of the invention.
In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium on which a computer program is stored, which when executed by a processor, implements a neural network computing type storage method according to any of the embodiments of the present invention.
The method comprises the steps of obtaining first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data; configuring a first preset rule based on the first neural network calculation type; storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network; the first data to be calculated flows in the data flow network according to a preset data flow direction, so that the problem that when a chip of a data flow architecture supports multiple neural network calculation types, the calculation efficiency of the chip is reduced by supplementing data and increasing the calculation amount is solved, and the data of different network calculation types of the data flow architecture are stored according to different storage modes to achieve the effect of calculating the data of different network calculation types.
Drawings
Fig. 1 is a flowchart of a data storage method according to an embodiment of the present invention;
fig. 2 is a flowchart of a data storage method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a data storage device according to a third embodiment of the present invention;
FIG. 4 is a schematic structural diagram of another data storage device according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The present application will be described with reference to the accompanying drawings and examples. The specific embodiments described herein are merely illustrative of the application and are not intended to be limiting. For the purpose of illustration, only some, but not all, of the structures associated with the present application are shown in the drawings.
Some example embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. Further, the order of the steps may be rearranged. The process may be terminated when the various step operations are completed, but may have additional steps not included in the figure. A process may correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
The terms "first," "second," and the like may be used herein to describe various orientations, actions, steps, or elements, but the orientations, actions, steps, or elements are not limited by these terms. These terms are only used to distinguish one direction, action, step or element from another direction, action, step or element. For example, the first preset rule may be referred to as a second preset rule, and similarly, the second preset rule may be referred to as a first preset rule, without departing from the scope of the present application. Both the first preset rule and the second preset rule are preset rules, but the first preset rule and the second preset rule are not the same preset rule. The terms "first", "second", etc. are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present application, "plurality", "batch" means at least two, e.g., two, three, etc., unless otherwise limited.
Example one
Fig. 1 is a schematic flowchart of a data storage method according to an embodiment of the present application, which is applicable to a scenario in which data of different neural network computing types are computed, and the method may be executed by a data storage device, where the data storage device may be implemented in software and/or hardware, and may be integrated on a device.
As shown in fig. 1, a data storage method provided in an embodiment of the present application includes:
s110, first to-be-calculated data of a first layer of the neural network and a first neural network calculation type corresponding to the first to-be-calculated data are obtained.
In this embodiment, the neural network has multiple layers of computations, and when the computation of the current layer is completed, the data operation of the next layer is performed. The first layer of the neural network refers to the level at which the calculation starts first in the neural network model calculation. The first data to be calculated refers to data which needs to be calculated at the first layer of the neural network. The first neural network calculation type refers to a neural network calculation type corresponding to the first data to be calculated. In one embodiment, the first neural network type of computation includes, but is not limited to, a feedforward neural network, a radial basis neural network, a deep feedforward neural network, a recurrent neural network, and the like, and the first neural network type of computation is not limited herein.
In an embodiment, the neural network calculation type corresponding to the data to be calculated of each of the multiple layers of the neural network may be preset.
And S120, configuring a first preset rule based on the first neural network calculation type.
In this embodiment, the first preset rule is a rule applicable to data transmission and calculation corresponding to the calculation type of the first neural network. In an embodiment, the first preset rule is a rule for performing data processing on data to be calculated, which needs to be transmitted to a calculation module on a chip, according to a certain mode. In this embodiment, the first preset rule is a rule that the first to-be-calculated data is stored according to the sequence required by the calculation module, so that the first to-be-calculated data is sent to the calculation module according to the sequence required by the calculation module, and the data is provided to the calculation module for performing the first layer operation. The data to be calculated by the calculation module is sequenced in advance, so that the calculation efficiency of the chip is improved. In one embodiment, before the neural network model starts to calculate, preset rules corresponding to different neural network calculation types are configured in advance, and when the neural network model starts to calculate, a first preset rule is configured according to the association relationship between the configured neural network calculation type and the preset rules and the first neural network calculation type in the first data to be calculated.
S130, storing the first to-be-calculated data based on the first preset rule, so that the first to-be-calculated data are sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the first neural network calculation type.
In this embodiment, the calculation module performs data calculation on the first layer of the neural network model according to a first preset rule. The first data to be calculated flows in the data flow network according to a preset data flow direction, the data flow can be obtained without depending on an instruction, and the calculation module can calculate the data only by waiting for the data to come. The first data order refers to a data order mapped with an operation order of the first neural network computation type. Specifically, when the data is processed according to the first neural network calculation type, the first data to be calculated is processed according to the operation sequence corresponding to the first neural network calculation type. In this embodiment, the first data to be calculated flows to the calculation module in a data flow manner, and therefore, the first data to be calculated needs to be sequentially arranged according to the first data sequence and then sent to the calculation module for calculation. After the first data to be calculated are arranged in order according to the first data sequence, the calculation module can circularly control the reading operation and control the address addressing of the reading operation to extract the data for calculation.
In this embodiment, the neural network calculation type of the first data to be calculated is determined, the preset rule is configured for different neural network calculation types, and the first data to be calculated is stored based on the configured preset rule so that the calculation module can calculate the first data to be calculated, and the calculation module is not limited to calculating for one neural network calculation type. In one embodiment, the computation module performs fixed addition and multiplication operations during data computation, and the on-chip storage module satisfies different computation modes of the computation module by storing different data arrangement modes.
According to the technical scheme of the embodiment of the application, first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data are obtained; configuring a first preset rule based on the first neural network calculation type; and storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network, wherein the first data to be calculated flows in the data flow network according to a preset data flow direction. The neural network computing provided by the embodiment is not limited to a neural network of one computing type, but a preset rule is configured according to the neural network computing type, so that the problem that the network computing type supports a single network or cannot flexibly support multiple types of networks in the related technology is solved, and the technical effect of computing data of different network computing types of a data flow architecture by storing the data of different network computing types according to different storage modes is achieved. In addition, the technical scheme of the embodiment of the application can keep high calculation efficiency.
Example two
Fig. 2 is a schematic flowchart of a data storage method according to a second embodiment of the present application. The present embodiment explains the above embodiments, and is applicable to a scenario of calculating data of different neural network calculation types. The method may be performed by a data storage device, which may be implemented in software and/or hardware, and may be integrated on a device.
As shown in fig. 2, a data transmission method of a neural network provided in the second embodiment of the present application includes:
s210, first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data are obtained.
In this embodiment, the neural network has multiple layers of computations, and when the computation of the current layer is completed, the data operation of the next layer is performed. The first layer of the neural network refers to the level at which the calculation starts first in the neural network model calculation. The first data to be calculated refers to data which needs to be calculated at the first layer of the neural network. The first neural network calculation type refers to a neural network calculation type corresponding to the first data to be calculated. In one embodiment, the neural network calculation types include, but are not limited to, a feed-forward neural network, a radial basis function neural network, a deep feed-forward neural network, a recurrent neural network, and the like, and the neural network calculation types are not limited herein.
In an embodiment, the neural network calculation type corresponding to the data to be calculated of each of the multiple layers of the neural network may be preset.
In this embodiment, the first data to be calculated includes at least one calculation parameter. In one embodiment, the calculation parameters include a convolution kernel size (kernel size), a step size (stride), a convolution kernel channel (channel), a filter (filter), and the like, and the type of the calculation parameters is not limited herein. Specifically, at least one of the kernel size, stride, channel and filter of different neural network calculation types has different calculation parameters. S220, configuring a first preset rule based on the first neural network calculation type.
In this embodiment, the first preset rule is a rule applicable to data transmission and calculation corresponding to the calculation type of the first neural network. In an embodiment, the first preset rule is a rule for performing data processing on data to be calculated, which needs to be transmitted to a calculation module on a chip, according to a certain mode. In this embodiment, the first preset rule is a rule that the first to-be-calculated data is stored according to the sequence required by the calculation module, so that the first to-be-calculated data is sent to the calculation module according to the sequence required by the calculation module, and the data is provided to the calculation module for performing the first layer operation. In one embodiment, before the neural network model starts to calculate, preset rules corresponding to different neural network calculation types are configured in advance, and when the neural network model starts to calculate, a first preset rule is configured according to the association relationship between the configured neural network calculation type and the preset rules and the first neural network calculation type in the first data to be calculated.
S230, storing the first to-be-calculated data based on the first preset rule, so that the first to-be-calculated data are sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network.
In one embodiment, the calculation module performs data calculation on a first layer of the neural network model according to a first preset rule.
In this embodiment, the neural network calculation type of the first data to be calculated is determined, the preset rule is configured for different neural network calculation types, and the first data to be calculated is stored based on the configured preset rule so that the calculation module can calculate the first data to be calculated, and the calculation module is not limited to calculating for one neural network calculation type. The first data to be calculated flows in the data flow network according to a preset data flow.
In S230, the first preset rule includes a preset storage rule and a preset calculation rule, and S230 includes: and storing the first data to be calculated based on the preset storage rule. Further included after S230 is: and transmitting the preset calculation rule to the calculation module so that the calculation module can calculate the first data to be calculated according to the preset calculation rule.
In this embodiment, the preset storage rule refers to a rule for sorting data in a certain order. Specifically, the preset storage rule is a rule for storing the first data to be calculated according to the first data sequence. In one embodiment, the data sorting is determined according to the calculation sequence of the calculation module, and the data is sorted in advance, so that the calculation efficiency of the calculation module can be improved. In one embodiment, the preset storage rule may be ordering of different data, such as data, weight, and bias; it is also possible to sort the same data, such as the pixel size of the picture or the three colors red, blue and yellow, which is not limited herein. The preset calculation rule refers to a rule for calculating data by the calculation module. Specifically, the preset calculation rule is a rule for performing calculation according to the calculation type of the first neural network. In one embodiment, the predetermined calculation rule is to pull data in order for calculation.
In this embodiment, storing the first to-be-calculated data based on the preset storage rule includes: and storing the first data to be calculated to an on-chip memory according to the first data sequence based on the preset storage rule, and transmitting the first data to be calculated to the calculation module after the first data to be calculated is sequenced according to the first data sequence through the on-chip memory.
In this step, for the first data to be calculated, which needs to be calculated by the neural network model, the neural network calculation type of the first data to be calculated does not need to be identified for transmission to different on-chip memories. After all the neural network calculation types are transmitted to the same on-chip memory, data are sequenced according to the operation sequence of the neural network calculation types, and then the preset rules of the neural network calculation types are configured, so that the arrangement space on a chip can be reduced, and the flexibility of data storage can be improved.
S240, obtaining second to-be-calculated data of a second layer of the neural network and a second neural network calculation type corresponding to the second to-be-calculated data.
In this embodiment, the second layer of the neural network refers to a layer below the first layer of the neural network. The second data to be calculated refers to data required to be calculated by the second layer of the neural network. The second neural network calculation type refers to a neural network calculation type of the second data to be calculated. In an embodiment, the second neural network type of computation includes, but is not limited to, a feedforward neural network, a radial basis neural network, a deep feedforward neural network, a recurrent neural network, and the like, and the second neural network type of computation is not limited herein.
In this embodiment, the second data to be calculated includes at least one calculation parameter. In one embodiment, the calculation parameters include kernel size, stride, channel, filter, etc., and the type of calculation parameters is not limited herein.
S250, judging whether the first neural network calculation type is the same as the second neural network calculation type.
Illustratively, if the first neural network computation type is a deep feedforward neural network and the second neural network computation type is also a deep feedforward neural network, the first neural network computation type and the second neural network computation type are the same. If the first neural network computation type is a deep feed-forward neural network and the second neural network computation type is a recurrent neural network, the first neural network computation type and the second neural network computation type are not the same.
S260, responding to a judgment result that the first neural network calculation type is the same as the second neural network calculation type, and storing the second data to be calculated based on the first preset rule.
In an embodiment, the first neural network calculation type is the same as the second neural network calculation type, and the first preset rule is also applicable to calculation of the neural network calculation type of the second layer, and may directly start data calculation for the second layer of the neural network, and calculate the second data to be calculated in the second layer of the neural network.
S270, responding to a judgment result that the first neural network computing type is different from the second neural network computing type, configuring a second preset rule based on the second neural network computing type, and storing the second data to be computed based on the second preset rule, so that the second data to be computed are sent to a computing module in the data flow network for computation according to a second data sequence matched with the second neural network computing type.
In this embodiment, the second preset rule is a rule applicable to data transmission and calculation corresponding to the calculation type of the second neural network. The second data order refers to a data order mapped to an operation order of the second neural network computation type. Specifically, when the calculation type of the second network neural network is different from that of the first neural network, for example, the sizes of convolution kernels are different, the required data sequence is different, and therefore when the calculation type of the first neural network is different from that of the second neural network, the second data to be calculated needs to be stored in the on-chip memory according to the second data sequence corresponding to the calculation type of the second neural network, so that the second data to be calculated is supplied to the calculation module for calculation when flowing to the calculation module. In an embodiment, the second preset rule is a rule for performing data processing on data to be calculated, which needs to be transmitted to the calculation module on the chip, according to a certain mode. In this embodiment, the second preset rule is a rule that the second to-be-calculated data is stored according to the sequence required by the calculation module, so that the second to-be-calculated data is sent to the calculation module according to the sequence required by the calculation module, and the data is provided to the calculation module for performing the second-layer operation.
In an alternative embodiment, it may not be necessary to determine whether the second neural network computation type is the same as the first neural network computation type. And directly configuring a second preset rule according to the calculation type of the second neural network. And if the second neural network calculation type is the same as the first neural network calculation type, the second preset rule is also the same as the first preset rule.
In another alternative embodiment, the third and even more layers of the data to be calculated of the neural network are acquired, and the hierarchy of the acquired data to be calculated needs to be determined according to the number of the hierarchies of the calculation model of the neural network.
For example, when the data is image data, in the field of artificial intelligence, a convolution network is generally used to process the image data. For a convolutional network, there are multiple convolutional layers, and the convolutional kernel size, step size, filter, and the like of different convolutional layers are different, that is, the calculation types of the neural networks corresponding to different convolutional layers are different. When image data enters the beginning processing of a first convolution layer, judging the first neural network calculation type of the first convolution layer, then storing the image data in an on-chip memory according to a first preset rule corresponding to the first neural network calculation type in order of the image data according to the channel/width/height characteristic of the image data, directly sending the data stream of the first data order to a calculation module for calculation, and outputting a first feature map (characteristic map) when the calculation of the first convolution layer is completed. The image data entered into the first convolution layer is also a feature map. When the first feature map starts to enter the second convolutional layer for processing, whether the second neural network calculation type of the second convolutional layer is the same as the first neural network calculation type is judged, if not, the first feature map is arranged in an on-chip memory according to a second preset rule corresponding to the second neural network calculation type according to the channel/width/height characteristic of the second feature map (namely, the second data to be calculated) and then is directly sent to a calculation module for calculation according to the data stream of the second data sequence. And so on, processing the image in the convolutional network.
It can be understood that, when the calculation types of the neural networks are different, the data are firstly subjected to linear conversion to meet the calculation requirements of the calculation module, the operation of convolution of different characteristics of a plurality of neural networks in a compatible data stream architecture can be ensured, extra time consumption is not increased, the high efficiency and flexibility of the operation of the data stream architecture are ensured, and the convolution operation of the plurality of neural networks can be met in a data stream structure clock.
According to the technical scheme of the embodiment of the application, first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data are obtained; configuring a first preset rule based on the first neural network calculation type; and storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in the data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network, after the calculation module calculates the first data to be calculated, acquiring second data to be calculated of a second layer of the neural network and a second neural network calculation type corresponding to the second data to be calculated, and determining a data storage mode aiming at the second layer of the neural network by judging whether the calculation type of the first neural network is the same as the calculation type of the second neural network. The neural network calculation provided by the embodiment is not limited to one type of neural network, but a preset rule is configured according to the neural network calculation type, so that the problem that the network calculation type supports a single type or can not flexibly support multiple types of networks in the related technology is solved, and the technical effect of calculating data of different network calculation types is achieved by storing data of different network calculation types according to different storage modes. In addition, the technical scheme of the embodiment of the application can keep high calculation efficiency.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a data storage device according to a third embodiment of the present invention, where this embodiment is applicable to a scenario of performing computation on data of different neural network computation types, and the data storage device may be implemented in a software and/or hardware manner and may be integrated on a device.
As shown in fig. 3, the data storage apparatus provided in this embodiment may include an obtaining module 310, a configuring module 320, and an on-chip storing module 330, where: an obtaining module 310, configured to obtain first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data; a configuration module 320 configured to configure a first preset rule based on the first neural network computation type; the on-chip storage module 330 is configured to store the first to-be-calculated data based on the first preset rule, so that the first to-be-calculated data is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network; the first data to be calculated flows in the data flow network according to a preset data flow.
Referring to fig. 4, in an embodiment, the obtaining module 310 is further configured to obtain second data to be calculated of a second layer of the neural network and a second neural network calculation type corresponding to the second data to be calculated.
The device further comprises: a determining module 340, configured to determine whether the first neural network calculation type is the same as the second neural network calculation type; the on-chip storage module 330 is further configured to, in response to a determination result that the first neural network computation type is the same as the second neural network computation type, store the second data to be computed based on the first preset rule; and responding to a judgment result that the first neural network computing type is different from the second neural network computing type, configuring a second preset rule based on the second neural network computing type, and storing the second data to be computed based on the second preset rule, so that the second data to be computed is sent to a computing module in the data flow network for computation according to a second data sequence matched with the second neural network computing type.
In an embodiment, the first preset rule includes a preset storage rule and a preset calculation rule.
The on-chip memory module 330 includes: the storage unit is used for storing the first data to be calculated based on a preset storage rule, wherein the preset storage rule is a rule for storing the first data to be calculated according to the first data sequence; and the sending unit is used for transmitting the preset calculation rule to the calculation module so that the calculation module can calculate the first data to be calculated according to the preset calculation rule, wherein the preset calculation rule is a rule calculated according to the calculation type of the first neural network.
In one embodiment, the first data to be calculated includes at least one calculation parameter, and the second data to be calculated includes at least one calculation parameter.
In one embodiment, the calculating the parameter includes: at least one of kernel size, stride, channel, and filter.
In an embodiment, the storage unit is configured to store the first data to be calculated to an on-chip memory according to the first data sequence based on the preset storage rule, and transmit the first data to be calculated to the calculation module after the first data to be calculated is sorted according to the first data sequence by the on-chip memory.
The data storage device provided by the embodiment of the application can execute the data storage method provided by any embodiment of the application, and has corresponding functional modules and beneficial effects of the execution method. Reference may be made to the description in any method embodiment of the present application for content not described in this embodiment.
Example four
Fig. 5 is a schematic structural diagram of an apparatus provided in the fourth embodiment of the present application. Fig. 5 illustrates a block diagram of an exemplary device 612 suitable for use in implementing embodiments of the present application. The device 612 shown in fig. 5 is only an example and should not bring any limitations to the functionality or scope of use of the embodiments of the present application.
As shown in fig. 5, the device 612 is in the form of a general purpose device. Components of device 612 may include, but are not limited to: one or more processors 616, a memory device 628, and a bus 618 that couples the various system components including the memory device 628 and the processors 616.
Bus 618 represents one or more of any of several types of bus structures, including a memory device bus or memory device controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
In one embodiment, device 612 includes a variety of computer-system readable media. Such media can be any available media that is accessible by device 612 and includes both volatile and nonvolatile media, removable and non-removable media.
Storage 628 may include computer system readable media in the form of volatile Memory, such as Random Access Memory (RAM) 630 and/or cache Memory 632. In one embodiment, terminal 612 may include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 634 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk such as a Compact disk Read-Only Memory (CD-ROM), Digital Video disk Read-Only Memory (DVD-ROM) or other optical media may be provided. In such cases, each drive may be connected to bus 618 by one or more data media interfaces. Storage device 628 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the application.
A program/utility 640 having a set (at least one) of program modules 642 may be stored, for example, in storage 628, such program modules 642 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or a combination thereof may include implementation of a network environment. The program modules 642 generally perform the functions and/or methods of the embodiments described herein.
The device 612 may also communicate with one or more external devices 614 (e.g., keyboard, pointing terminal, display 624, etc.), with one or more terminals that enable a user to interact with the device 612, and/or with any terminals (e.g., network card, modem, etc.) that enable the device 612 to communicate with one or more other computing terminals. Such communication may be through an Input/Output (I/O) interface 622. Also, the device 612 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public Network, such as the internet) via the Network adapter 620. As shown in FIG. 5, the network adapter 620 communicates with the other modules of the device 612 via the bus 618. Although not shown in the figures, other hardware and/or software modules may be used in conjunction with device 612, including but not limited to: microcode, end drives, Redundant processors, external disk drive Arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems, among others.
The processor 616 executes programs stored in the storage device 628 to perform various functional applications and data processing, for example, implement a data storage method provided in any embodiment of the present application, and the method may include: acquiring first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data; configuring a first preset rule based on the first neural network calculation type; storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network; the first data to be calculated flows in the data flow network according to a preset data flow.
According to the technical scheme of the embodiment of the application, first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data are obtained; configuring a first preset rule based on the first neural network calculation type; and storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network, wherein the first data to be calculated flows in the data flow network according to a preset data flow direction. The neural network computing provided by the embodiment is not limited to a neural network of one computing type, but a preset rule is configured according to the neural network computing type, so that the problem that the network computing type supports a single network or cannot flexibly support multiple types of networks in the related technology is solved, and the technical effect of computing data of different network computing types of a data flow architecture by storing the data of different network computing types according to different storage modes is achieved. In addition, the technical scheme of the embodiment of the application can keep high calculation efficiency.
An embodiment of the present application further provides an apparatus, including: the Memory device comprises a configuration device, a Direct Memory Access (DMA) device, an external storage device and an on-chip storage device. Wherein the configuration means may be a processor; the external storage device may be a Double Data Rate (DDR) memory; the DMA device is connected with the external storage device and the on-chip storage device and receives the control of the configuration device; the DMA device carries data in the external storage device to the on-chip storage device according to the processor configuration, and the on-chip storage device stores the data according to the processor configuration mode. When the DMA device is executed by the processor, the DMA device transmits data of the external storage device to the on-chip storage device according to the processor configuration, and when the on-chip storage device is configured by the processor, the on-chip storage device stores the data transmitted by the DMA device in the on-chip storage according to the processor configuration mode, so that the data storage method provided by any embodiment of the application is realized.
EXAMPLE five
An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements a data storage method provided in any embodiment of the present application, where the method may include: acquiring first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data; configuring a first preset rule based on the first neural network calculation type; storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network; the first data to be calculated flows in the data flow network according to a preset data flow.
The computer-readable storage media of the embodiments of the present application may take any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. Examples (a non-exhaustive list) of the computer-readable storage medium include: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a RAM, a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM or flash Memory), an optical fiber, a CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, Radio Frequency (RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or terminal. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a LAN or a WAN, or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
According to the technical scheme of the embodiment of the application, first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data are obtained; configuring a first preset rule based on the first neural network calculation type; and storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network, wherein the first data to be calculated flows in the data flow network according to a preset data flow direction. The neural network computation provided by the embodiment is not limited to one type of neural network, but a preset rule is configured according to the neural network computation type, so that the problem that the network computation type supports a single type or cannot flexibly support multiple types of networks in the related technology is solved, and the technical effect of computing the data of different network computation types of the data flow architecture by storing the data of different network computation types according to different storage modes is achieved. In addition, the technical scheme of the embodiment of the application can keep high calculation efficiency.
The embodiment of the application also provides a storage configuration storage medium which can be configured by the processor, external storage data can be stored according to different configuration sequences, and the data is transmitted to the storage device by the processor through the DMA device to be executed, so that the data storage method provided by any embodiment of the application is realized.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (8)

1. A method of storing data, comprising:
acquiring first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data;
configuring a first preset rule based on the first neural network calculation type;
storing the first data to be calculated based on the first preset rule so that the first data to be calculated is sent to a calculation module in a data flow network for calculation according to a first data sequence matched with the calculation type of the first neural network;
the first data to be calculated flows in the data flow network according to a preset data flow direction;
after the storing the first to-be-calculated data based on the first preset rule, the method further includes:
acquiring second data to be calculated of a second layer of a neural network and a second neural network calculation type corresponding to the second data to be calculated;
judging whether the first neural network calculation type is the same as the second neural network calculation type;
responding to a judgment result that the first neural network computing type is the same as the second neural network computing type, and storing the second data to be computed based on the first preset rule;
and responding to a judgment result that the first neural network computing type is different from the second neural network computing type, configuring a second preset rule based on the second neural network computing type, and storing the second data to be computed based on the second preset rule, so that the second data to be computed is sent to a computing module in the data flow network for computation according to a second data sequence matched with the second neural network computing type.
2. The method of claim 1, wherein the first preset rule includes a preset storage rule and a preset calculation rule;
the storing the first to-be-calculated data based on the first preset rule includes:
storing the first data to be calculated based on the preset storage rule, wherein the preset storage rule is a rule for storing the first data to be calculated according to the first data sequence;
after the configuring the first preset rule based on the first neural network computation type, further comprising: and transmitting the preset calculation rule to a calculation module so that the calculation module can calculate the first data to be calculated according to the preset calculation rule, wherein the preset calculation rule is a rule calculated according to the calculation type of the first neural network.
3. The method of claim 1, wherein the first data to be calculated includes at least one calculation parameter and the second data to be calculated includes at least one calculation parameter.
4. The method of claim 3, wherein calculating parameters comprises: at least one of a convolution kernel size, step size stride, convolution kernel channel, and filter.
5. The method of claim 2, wherein the storing the first data to be calculated based on the preset storage rule comprises:
and storing the first data to be calculated to an on-chip memory according to the first data sequence based on the preset storage rule, and transmitting the first data to be calculated to the calculation module after the first data to be calculated is sequenced according to the first data sequence through the on-chip memory.
6. A data storage device, comprising:
the acquisition module is used for acquiring first to-be-calculated data of a first layer of a neural network and a first neural network calculation type corresponding to the first to-be-calculated data;
the configuration module is used for configuring a first preset rule based on the first neural network calculation type;
the on-chip storage module is used for storing the first to-be-calculated data based on the first preset rule so that the first to-be-calculated data are sent to the calculation module in the data flow network for calculation according to the first data sequence matched with the calculation type of the first neural network;
the first data to be calculated flows in the data flow network according to a preset data flow direction;
the acquisition module is further used for acquiring second data to be calculated of a second layer of the neural network and a second neural network calculation type corresponding to the second data to be calculated;
the device further comprises: the judging module is used for judging whether the first neural network calculation type is the same as the second neural network calculation type;
the on-chip storage module is further used for responding to a judgment result that the first neural network computing type is the same as the second neural network computing type, and storing the second data to be computed based on the first preset rule; and responding to a judgment result that the first neural network computing type is different from the second neural network computing type, configuring a second preset rule based on the second neural network computing type, and storing the second data to be computed based on the second preset rule, so that the second data to be computed is sent to a computing module in the data flow network for computation according to a second data sequence matched with the second neural network computing type.
7. A data storage device, comprising:
at least one processor;
storage means for storing at least one program;
when executed by the at least one processor, cause the at least one processor to implement the data storage method of any one of claims 1-5.
8. A computer-readable storage medium, characterized in that a computer program is stored which, when being executed by a processor, implements the data storage method according to any one of claims 1-5.
CN202010764719.8A 2020-08-03 2020-08-03 Data storage method, device, equipment and storage medium Active CN111737193B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010764719.8A CN111737193B (en) 2020-08-03 2020-08-03 Data storage method, device, equipment and storage medium
PCT/CN2021/106394 WO2022028224A1 (en) 2020-08-03 2021-07-15 Data storage method and apparatus, and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010764719.8A CN111737193B (en) 2020-08-03 2020-08-03 Data storage method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111737193A CN111737193A (en) 2020-10-02
CN111737193B true CN111737193B (en) 2020-12-08

Family

ID=72657002

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010764719.8A Active CN111737193B (en) 2020-08-03 2020-08-03 Data storage method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN111737193B (en)
WO (1) WO2022028224A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111737193B (en) * 2020-08-03 2020-12-08 深圳鲲云信息科技有限公司 Data storage method, device, equipment and storage medium
CN115081607A (en) * 2022-05-19 2022-09-20 北京百度网讯科技有限公司 Reverse calculation method, device and equipment based on embedded operator and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110782015A (en) * 2019-10-25 2020-02-11 腾讯科技(深圳)有限公司 Training method and device for network structure optimizer of neural network and storage medium
CN111091183A (en) * 2019-12-17 2020-05-01 深圳鲲云信息科技有限公司 Neural network acceleration system and method

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10762894B2 (en) * 2015-03-27 2020-09-01 Google Llc Convolutional neural networks
US10049322B2 (en) * 2015-05-21 2018-08-14 Google Llc Prefetching weights for use in a neural network processor
CN106529669A (en) * 2016-11-10 2017-03-22 北京百度网讯科技有限公司 Method and apparatus for processing data sequences
CN110717574B (en) * 2018-07-11 2023-07-07 杭州海康威视数字技术股份有限公司 Neural network operation method and device and heterogeneous intelligent chip
CN109360154B (en) * 2018-10-29 2022-09-20 厦门美图之家科技有限公司 Convolutional neural network generation method and super-resolution method of image
CN109740508B (en) * 2018-12-29 2021-07-23 北京灵汐科技有限公司 Image processing method based on neural network system and neural network system
CN109799977B (en) * 2019-01-25 2021-07-27 西安电子科技大学 Method and system for developing and scheduling data by instruction program
CN110046704B (en) * 2019-04-09 2022-11-08 深圳鲲云信息科技有限公司 Deep network acceleration method, device, equipment and storage medium based on data stream
CN111309265B (en) * 2020-02-18 2023-06-13 深圳鲲云信息科技有限公司 Node storage method, system, server and storage medium based on neural network
CN111260019B (en) * 2020-02-18 2023-04-11 深圳鲲云信息科技有限公司 Data processing method, device and equipment of neural network model and storage medium
CN111737193B (en) * 2020-08-03 2020-12-08 深圳鲲云信息科技有限公司 Data storage method, device, equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110782015A (en) * 2019-10-25 2020-02-11 腾讯科技(深圳)有限公司 Training method and device for network structure optimizer of neural network and storage medium
CN111091183A (en) * 2019-12-17 2020-05-01 深圳鲲云信息科技有限公司 Neural network acceleration system and method

Also Published As

Publication number Publication date
CN111737193A (en) 2020-10-02
WO2022028224A1 (en) 2022-02-10

Similar Documents

Publication Publication Date Title
CN109104876B (en) Arithmetic device and related product
CN109858019B (en) Dialogue state tracking method and device, storage medium and semantic recognition system
CN111737193B (en) Data storage method, device, equipment and storage medium
CN111145076B (en) Data parallelization processing method, system, equipment and storage medium
WO2021259041A1 (en) Ai computational graph sorting method and apparatus, device, and storage medium
CN112068957A (en) Resource allocation method, device, computer equipment and storage medium
CN114925651A (en) Circuit routing determination method and related equipment
CN111813721B (en) Neural network data processing method, device, equipment and storage medium
CN111047005A (en) Operation method, operation device, computer equipment and storage medium
CN113438482B (en) Region-of-interest based video coding
CN109543835B (en) Operation method, device and related product
CN109558565B (en) Operation method, device and related product
CN109543834B (en) Operation method, device and related product
CN111026440B (en) Operation method, operation device, computer equipment and storage medium
CN111353125B (en) Operation method, operation device, computer equipment and storage medium
CN109543833B (en) Operation method, device and related product
CN109583580B (en) Operation method, device and related product
CN109543836B (en) Operation method, device and related product
CN109558943B (en) Operation method, device and related product
CN112395003A (en) Operation method, device and related product
CN111078596A (en) Flash chip control method, device and system and readable storage medium
CN111353595A (en) Operation method, device and related product
CN111339060B (en) Operation method, device, computer equipment and storage medium
CN111290788B (en) Operation method, operation device, computer equipment and storage medium
CN112396169B (en) Operation method, device, computer equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant