WO2022247908A1 - 权重矩阵的数据存储方法、数据获取方法及装置、设备 - Google Patents

权重矩阵的数据存储方法、数据获取方法及装置、设备 Download PDF

Info

Publication number
WO2022247908A1
WO2022247908A1 PCT/CN2022/095238 CN2022095238W WO2022247908A1 WO 2022247908 A1 WO2022247908 A1 WO 2022247908A1 CN 2022095238 W CN2022095238 W CN 2022095238W WO 2022247908 A1 WO2022247908 A1 WO 2022247908A1
Authority
WO
WIPO (PCT)
Prior art keywords
weight
value
matrix
special
type
Prior art date
Application number
PCT/CN2022/095238
Other languages
English (en)
French (fr)
Inventor
吴臻志
杨鸣鹤
祝夭龙
Original Assignee
北京灵汐科技有限公司
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
Priority claimed from CN202110585872.9A external-priority patent/CN114527930B/zh
Priority claimed from CN202110585727.0A external-priority patent/CN114546251B/zh
Application filed by 北京灵汐科技有限公司 filed Critical 北京灵汐科技有限公司
Priority to US18/266,658 priority Critical patent/US20240046113A1/en
Publication of WO2022247908A1 publication Critical patent/WO2022247908A1/zh

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/10Interfaces, programming languages or software development kits, e.g. for simulating neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • Embodiments of the present disclosure relate to the technical field of artificial intelligence, and in particular, to a data storage method of a weight matrix, a data acquisition method and device, electronic equipment, and a computer-readable storage medium.
  • Brain-like computing technology has been widely used in intelligence science, cognitive science, information processing, artificial intelligence and other fields, and can be used to recognize and process text, images, audio and video, etc.
  • the human brain includes a large number (eg, about 100 billion) of neurons, and a brain-like chip (neuromorphic chip) simulates the work of the human brain by setting a large number of electronically simulated neurons.
  • Neurons need to use a lot of "weights (such as connection weights)" during their work.
  • weights can exist in the form of "weight matrix”, and each element of the weight matrix is a weight value (such as a connection weight value).
  • Embodiments of the present disclosure provide a data storage method for a weight matrix, a data acquisition method and device, electronic equipment, and a computer-readable storage medium, which can effectively reduce the storage space occupied by the weight matrix.
  • an embodiment of the present disclosure provides a data storage method for a weight matrix, including:
  • the storage space occupied by the encoding array and the special value table is smaller than the storage space occupied by the weight matrix; the special value table includes all special weight values in the weight matrix set in sequence.
  • the encoding array includes a connectivity matrix and a data type table
  • connection matrix is the same as that of the weight matrix, and the elements of the connection matrix are the connection types of the weight values of the corresponding elements in the weight matrix; the data volume of at least part of the connection types is smaller than the corresponding weight value The amount of data, and the connection type is divided into valid connection and invalid connection;
  • the data type table includes sequentially set data types corresponding to the weight values of valid connections in the weight matrix; at least some of the data types have a data volume smaller than the corresponding weight value, and the data types include special value type and a plurality of first preset value types, the first preset value type corresponds to a first preset weight value, and the first preset weight value is a preset weight value of an effective connection, and the special value type Corresponding to the special weight value, the weight values of other effective connections except the first preset weight value belong to the special weight value.
  • said encoding array comprises a type matrix
  • the structure of the type matrix is the same as that of the weight matrix, and the elements of the type matrix are the types of the weight values of the corresponding elements in the weight matrix, and the data volume of at least some types is smaller than the data volume of the corresponding weight values;
  • the type includes a special value type and a plurality of second preset value types; the second preset value type corresponds to a second preset weight value, and the special value type corresponds to the special weight value, except for the second Weight values other than the preset weight values are special weight values.
  • an embodiment of the present disclosure provides a data storage method for a weight matrix, including:
  • connection matrix data type table, special value table according to weight matrix
  • connection matrix Store the connection matrix, data type table, and special value table
  • connection matrix has the same structure as the weight matrix, and each element is the connection type of the weight value of the corresponding element in the weight matrix; the data volume of a connection type is less than the data volume of a weight value, and the connection type is divided into valid connection and invalid connection ;
  • the data type table includes the data types corresponding to the weight values of effective connections in the weight matrix that are set in sequence; the data volume of a data type is less than the data volume of a weight value, and the data types include special value types and multiple preset value types.
  • a preset value type corresponds to a preset weight value of an effective connection
  • a special value type corresponds to a special weight value
  • the weight values of other valid connections except the preset weight value are special weight values
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • an embodiment of the present disclosure provides a data storage method for a weight matrix, including:
  • the type matrix has the same structure as the weight matrix, each element of which is the type corresponding to the weight value of the corresponding element in the weight matrix, and the data volume of a type is less than the data volume of a weight value;
  • the types include special value types and A plurality of preset value types; each of the preset value types corresponds to a preset weight value, the special value type corresponds to a special weight value, and other weight values except the preset weight value are special weight values;
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • an embodiment of the present disclosure provides a data acquisition method for a weight matrix, including:
  • the storage space occupied by the encoding array and the special value table is smaller than the storage space occupied by the weight matrix; the special value table includes all special weight values in the weight matrix set in sequence.
  • the encoding array includes a connectivity matrix and a data type table
  • connection matrix is the same as that of the weight matrix, and the elements of the connection matrix are the connection types of the weight values of the corresponding elements in the weight matrix; the data volume of at least part of the connection types is smaller than the corresponding weight value The amount of data, and the connection type is divided into valid connection and invalid connection;
  • the data type table includes sequentially set data types corresponding to the weight values of valid connections in the weight matrix; at least some of the data types have a data volume smaller than the corresponding weight value, and the data types include special value type and a plurality of first preset value types, the first preset value type corresponds to a first preset weight value, and the first preset weight value is a preset weight value of an effective connection, and the special value type Corresponding to the special weight value, the weight values of other effective connections except the first preset weight value belong to the special weight value.
  • said encoding array comprises a type matrix
  • the structure of the type matrix is the same as that of the weight matrix, and the elements of the type matrix are the types of the weight values of the corresponding elements in the weight matrix, and the data volume of at least some types is smaller than the data volume of the corresponding weight values;
  • the type includes a special value type and a plurality of second preset value types; the second preset value type corresponds to the second preset weight value, and the special value type corresponds to the special weight value, except for the Weight values other than the second preset weight value belong to special weight values.
  • the embodiment of the present disclosure provides a data acquisition method of a weight matrix, including:
  • connection matrix has the same structure as the weight matrix, and each element is the connection type of the weight value of the corresponding element in the weight matrix; the data volume of a connection type is less than the data volume of a weight value, and the connection type is divided into valid connection and invalid connection ;
  • the data type table includes the data types corresponding to the weight values of effective connections in the weight matrix that are set in sequence; the data volume of a data type is less than the data volume of a weight value, and the data types include special value types and multiple preset value types.
  • a preset value type corresponds to a preset weight value of an effective connection
  • a special value type corresponds to a special weight value
  • the weight values of other valid connections except the preset weight value are special weight values
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • an embodiment of the present disclosure provides a data acquisition method for a weight matrix, including:
  • the type matrix has the same structure as the weight matrix, each element of which is the type corresponding to the weight value of the corresponding element in the weight matrix, and the data volume of a type is less than the data volume of a weight value;
  • the types include special value types and A plurality of preset value types; each of the preset value types corresponds to a preset weight value, the special value type corresponds to a special weight value, and other weight values except the preset weight value are special weight values;
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • an embodiment of the present disclosure provides a weight matrix data acquisition device, including: a processing unit and at least one acquisition unit;
  • the processing unit is configured to determine the weight value of the corresponding element in the weight matrix according to the pre-stored coding array and special value table;
  • the obtaining unit is configured to obtain the determined weight value
  • the storage space occupied by the encoding array and the special value table is smaller than the storage space occupied by the weight matrix; the special value table includes all special weight values in the weight matrix set in sequence.
  • the encoding array includes a connection matrix and a data type table
  • the processing unit includes: an address generator, a special value memory, an invalid value memory, and a first preset value memory; wherein, the connection matrix and The structure of the weight matrix is the same, and the elements of the connection matrix are the connection types of the weight values of the corresponding elements in the weight matrix; the data volume of at least some of the connection types is smaller than the data volume of the corresponding weight values, and the The connection type is divided into valid connection and invalid connection; the data type table includes data types corresponding to the weight value of the valid connection in the weight matrix set in sequence; at least part of the data type has a data volume smaller than the corresponding weight value The amount of data, and the data type includes a special value type and a plurality of first preset value types, the first preset value type corresponds to a first preset weight value, and the first preset weight value is a valid connection A preset weight value, the special value type corresponds to the special weight value, and the weight values of
  • the address generator is configured to sequentially generate the addresses of the elements in the connection matrix, and input them to the connection matrix memory of the corresponding acquisition unit;
  • the first preset value memory is configured to store the first preset weight value, and synchronously input the first preset weight value to the second gate of the acquisition unit;
  • the invalid value memory is configured to store the invalid weight value and input to the first gate of the acquisition unit
  • the special value memory is configured to store the special value table, input the current special weight value of the special value table to the second gate, and if an update signal is received, the current special weight value Update to the next special weight value of the special value table;
  • the acquisition unit includes:
  • connection matrix memory configured to store the connection matrix and input the connection type of the corresponding element of the connection matrix to the first gate and data type memory according to the received address
  • the data type memory is configured to input the corresponding data type of the prestored data type table to the second gate and special value judger when a valid connection is received;
  • the special value judger is configured to output an update signal to the special value memory when the received data type is a special value type
  • the second gate is configured to select an output from the received current special weight value and the first preset weight value according to the received data type
  • the first gate is configured to select an output from the received invalid weight value and the output of the second gate according to the received connection type.
  • the encoding array includes a type matrix
  • the processing unit includes: an address generator, a special value memory, and a second preset value memory; wherein, the type matrix has the same structure as the weight matrix, and The elements of the type matrix are the types of the weight values of the corresponding elements in the weight matrix, and the data volume of at least some types is smaller than the data volume of the corresponding weight values; the types include special value types and multiple second preset values type; the second preset value type corresponds to a second preset weight value, the special value type corresponds to the special weight value, and other weight values except the second preset weight value belong to special weight values;
  • the address generator is configured to sequentially generate the addresses of the elements in the type matrix, and input them to the type matrix memory of the corresponding acquisition unit;
  • the second preset value memory is configured to store the second preset weight value, and synchronously input the second preset weight value to the third gate of the acquisition unit;
  • the special value memory is configured to store the special value table, input the current special weight value of the special value table to the third gate, and input the current special weight value in the case of receiving an update signal update to the next special weight value of the special value table;
  • the acquisition unit includes:
  • a type matrix memory configured to store a type matrix, and input the type of the corresponding element of the type matrix to the third gate and special value determiner according to the received address;
  • the special value judger is configured to output an update signal to the special value memory when the received type is a special value type
  • the third gate is configured to select an output from the received current special weight value and the second preset weight value according to the received type.
  • an embodiment of the present disclosure provides a weight matrix data acquisition device, including an address generator, a special value memory, an invalid value memory, a preset value memory, and at least one acquisition unit; wherein,
  • the address generator is used to sequentially generate the address of each element in the connection matrix, and input it to the connection matrix memory of the corresponding acquisition unit;
  • the preset value memory is used to store all preset weight values, and input each preset weight value to the second gates of all acquisition units synchronously;
  • the invalid value memory is used to store invalid weight values, and is input to the first gates of all acquisition units;
  • the special value memory is used to store a special value table, input the current special weight value of the special value table to the second gate, and update the current special weight value to the next special weight value of the special value table when an update signal is received.
  • Each acquisition unit includes:
  • connection matrix memory for storing the connection matrix, and according to the received address, input the connection type of the corresponding element of the connection matrix to the first strobe and the data type memory;
  • the data type memory is used for inputting the corresponding data type of the prestored data type table therein to the second selector and the special value judger when a valid connection is received;
  • the special value judger is used to output an update signal to the special value memory when the received data type is a special value type
  • the second gate is used to select an output from the received current special weight value and each preset weight value according to the received data type
  • a first gate for selecting an output from the received invalid weight value, the output of the second gate, depending on the type of connection received
  • connection matrix has the same structure as the weight matrix, and each element is the connection type of the weight value of the corresponding element in the weight matrix; the data volume of a connection type is less than the data volume of a weight value, and the connection type is divided into valid connection and invalid connection ;
  • the data type table includes the data types corresponding to the weight values of effective connections in the weight matrix that are set in sequence; the data volume of a data type is less than the data volume of a weight value, and the data types include special value types and multiple preset value types.
  • a preset value type corresponds to a preset weight value of an effective connection
  • a special value type corresponds to a special weight value
  • the weight values of other valid connections except the preset weight value are special weight values
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • an embodiment of the present disclosure provides a weight matrix data acquisition device, including an address generator, a special value memory, a preset value memory, and at least one acquisition unit; wherein,
  • the address generator is used to sequentially generate the address of each element in the type matrix, and input it to the type matrix memory of the corresponding acquisition unit;
  • the preset value memory is used to store all preset weight values, and input each preset weight value to the gates of all acquisition units synchronously;
  • the special value memory is used to store a special value table, input the current special weight value of the special value table to the gate, and update the current special weight value to the next special weight value of the special value table when an update signal is received ;
  • Each acquisition unit includes:
  • the type matrix memory is used for storing the type matrix, and according to the received address, the type of the corresponding element of the type matrix is input to the gate device and the special value judger;
  • the special value judger is used to output an update signal to the special value memory when the received type is a special value type
  • a strobe is used to select an output from the received current special weight value and each preset weight value according to the received type
  • the type matrix has the same structure as the weight matrix, each element of which is the type corresponding to the weight value of the corresponding element in the weight matrix, and the data volume of a type is less than the data volume of a weight value;
  • the types include special value types and A plurality of preset value types; each of the preset value types corresponds to a preset weight value, the special value type corresponds to a special weight value, and other weight values except the preset weight value are special weight values;
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • an embodiment of the present disclosure provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor, and the processor implements the embodiments of the present disclosure when executing the computer program Any data storage method of weight matrix or data acquisition method of weight matrix.
  • the embodiments of the present disclosure provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, any weight matrix data storage method or weight matrix in the embodiments of the present disclosure is implemented. data acquisition method.
  • what is actually stored may include a coding array, a special value table, and a preset weight value, where the elements of the coding array only have the type of weight value, and the amount of data of each type is obviously much smaller than the data of the weight value Therefore, the storage space occupied by the encoding array is much smaller than that occupied by the weight matrix; and the special value table and preset weight values are only a few weight values in the weight matrix, so they occupy a small storage space.
  • FIG. 1 is a flowchart of a data storage method for a weight matrix provided by an embodiment of the present disclosure
  • FIG. 2 is a flow chart of a data storage method for a weight matrix provided by an embodiment of the present disclosure
  • FIG. 3 is a corresponding relationship diagram between a weight matrix and a connection matrix provided by an embodiment of the present disclosure
  • FIG. 4 is a flow chart of a data storage method for a weight matrix provided by an embodiment of the present disclosure
  • FIG. 5 is a flow chart of a data storage method for a weight matrix provided by an embodiment of the present disclosure
  • FIG. 6 is a corresponding relationship diagram between a weight matrix and a type matrix provided by an embodiment of the present disclosure
  • FIG. 7 is a flow chart of a method for storing data of a weight matrix provided by an embodiment of the present disclosure
  • FIG. 8 is a flowchart of a data acquisition method for a weight matrix provided by an embodiment of the present disclosure
  • FIG. 9 is a flow chart of a data acquisition method for a weight matrix provided by an embodiment of the present disclosure.
  • FIG. 10 is a flowchart of a data acquisition method for a weight matrix provided by an embodiment of the present disclosure.
  • FIG. 11 is a flowchart of a data acquisition method for a weight matrix provided by an embodiment of the present disclosure.
  • FIG. 12 is a block diagram of a weight matrix data acquisition device provided by an embodiment of the present disclosure.
  • FIG. 13 is a block diagram of another weight matrix data acquisition device provided by an embodiment of the present disclosure.
  • FIG. 14 is a flow chart of a data acquisition method for a weight matrix provided by an embodiment of the present disclosure.
  • FIG. 15 is a flowchart of another data acquisition method for a weight matrix provided by an embodiment of the present disclosure.
  • FIG. 16 is a flow chart of another data acquisition method for a weight matrix provided by an embodiment of the present disclosure.
  • FIG. 17 is a block diagram of a weight matrix data acquisition device provided by an embodiment of the present disclosure.
  • FIG. 18 is a block diagram of another weight matrix data acquisition device provided by an embodiment of the present disclosure.
  • FIG. 19 is a block diagram of a weight matrix data acquisition device provided by an embodiment of the present disclosure.
  • Fig. 20 is a block diagram of an electronic device provided by an embodiment of the present disclosure.
  • an embodiment of the present disclosure provides a data storage method of a weight matrix, which is used for storing data (information) of the weight matrix for use in a subsequent brain-inspired calculation process.
  • the weight matrix is used to store weights used in brain-inspired calculations (such as weights of neurons).
  • the weight matrix can be in a two-dimensional form or in a higher-dimensional form, and each element in it is a weight value.
  • the precision of all weight values in the weight matrix is the same, such as int8, fp16 and other forms.
  • FIG. 1 is a flow chart of a data storage method for a weight matrix provided by an embodiment of the present disclosure.
  • the data storage method of the embodiment of the present disclosure includes:
  • step S11 a coding array and a special value table are generated according to the weight matrix.
  • step S12 the encoding array and special value table are stored.
  • the storage space occupied by the encoding array and the special value table is smaller than the storage space occupied by the weight matrix; the above special value table includes all the special weight values in the weight matrix set in sequence.
  • the number of encoding arrays is one or more, and the elements in the encoding arrays are the types of the weight values of the corresponding elements in the weight matrix, and the amount of data of at least some types is less than the data of the corresponding weight values amount;
  • the special value table includes a plurality of special weight values in the weight matrix set in sequence, the special weight values include weight values in the weight matrix except the preset weight values, and the preset weight values are preset weight values.
  • the weight value of neurons can be represented by several relatively limited values.
  • the encoding array may include a connectivity matrix and a data type table.
  • connection matrix is the same as that of the weight matrix, and the elements of the connection matrix are the connection types of the weight values of the corresponding elements in the weight matrix; the data volume of at least some connection types is smaller than the data volume of the corresponding weight values, and the connection types are divided into effective Connections and invalid connections.
  • the data type table includes sequentially set data types corresponding to the weight values of effective connections in the weight matrix; at least some data types have a data volume smaller than the corresponding weight value data volume, and the data types include special value types and multiple first predetermined Set value type, the first preset value type corresponds to the first preset weight value, the first preset weight value is the preset weight value of the effective connection, the special value type corresponds to the special weight value, except the first preset weight value
  • the weight values of other valid connections are special weight values.
  • the weight matrix can be converted into the corresponding connection matrix, data type table and special value table, that is, the coding of the coding array includes two types, one type of coding
  • the code generated based on the connection of the weight value corresponds to the connection matrix
  • the other type is the code generated according to the data type of the weight value, corresponding to the data type table and the special value table.
  • the connection matrix is used to represent whether each weight value in the weight matrix is in a valid connection (or invalid connection)
  • the data type table corresponds to the data type of the weight value in a valid connection
  • the special value table includes several special weight values. When performing storage operations, it is sufficient to directly store the connection matrix, data type table and special value table.
  • the encoding array can also include a type matrix, the type matrix has the same structure as the weight matrix, and the elements of the type matrix are the types of the weight values of the corresponding elements in the weight matrix, and the data volume of at least some types is smaller than the corresponding The data volume of the weight value; the type includes a special value type and multiple second preset value types; the second default value type corresponds to the second preset weight value, and the special value type corresponds to a special weight value, except for the second preset weight value Other weight values are special weight values.
  • the weight matrix can be converted into a corresponding type matrix and special value table, that is, there is only one type of coding in the coding array, and the The code is determined and generated according to the valid connection/invalid connection type and the data type of the weight value.
  • the type matrix can not only represent whether the weight value is in a valid connection/invalid connection, but also can represent the data type of the weight value of the valid connection. When performing storage operations, it is sufficient to directly store the type matrix and the special value table.
  • the above is only an example of the coding array, and the coding array may also be set in other manners, which is not limited in this embodiment of the present disclosure.
  • weight values that appear repeatedly in the weight matrix by setting the encoding array and the special value table, these weight values are represented and stored by encoding with a smaller amount of data, which can effectively reduce storage space usage.
  • the weight matrix when the weight matrix needs to be used, the weight matrix can be accurately restored according to the encoding array, the special value table, and the pre-stored preset weight values.
  • FIG. 2 is a flowchart of a data storage method for a weight matrix provided by an embodiment of the present disclosure.
  • the data storage method of the embodiment of the present disclosure includes:
  • connection matrix Generate a connection matrix, a data type table, and a special value table according to the weight matrix.
  • connection matrix Store the connection matrix, the data type table, and the special value table.
  • connection matrix has the same structure as the weight matrix, and each element is the connection type of the weight value of the corresponding element in the weight matrix; the data volume of a connection type is less than the data volume of a weight value, and the connection type is divided into valid connection and invalid connection ;
  • the data type table includes the data types corresponding to the weight values of effective connections in the weight matrix that are set in sequence; the data volume of a data type is less than the data volume of a weight value, and the data types include special value types and multiple preset value types.
  • a preset value type corresponds to a preset weight value of an effective connection
  • a special value type corresponds to a special weight value
  • the weight values of other valid connections except the preset weight value are special weight values
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • connection matrix, data type table, and special value table are generated, and the connection matrix, data type table, and special value table are stored to reflect the weight
  • the information (data) of the matrix is used for the subsequent brain-inspired calculation process.
  • connection matrix the form and size of the connection matrix and the weight matrix are the same, so each element of the connection matrix must correspond to an element in the same relative position in the weight matrix. Moreover, the value of each element of the connection matrix is the "connection type" to which the weight value of its corresponding element in the weight matrix belongs.
  • weight value of the above invalid connection has no practical effect, it is not necessary to store its "specific value", but to indicate which elements in the weight matrix are 0 elements (weight value of invalid connection) and which are non-zero through the above connection matrix element (the weight value of the effective connection).
  • 1 is used to represent a valid connection (non-zero element) in the connection matrix, and 0 is used to represent an invalid connection (0 element).
  • each weight value of an effective connection of the weight matrix has a certain "data type".
  • many of the weight values of effective connections in the weight matrix are repeated multiple times, such as some excitation weight values, inhibition weight values, empty weights, etc., so each weight value that occurs multiple times (effective connection weight value) is defined as a preset weight value, making it belong to a "preset value type”; while other weight values (weight values of effective connections) in the weight matrix appear less, so they are all defined as special weights value, and belongs to the "special value type".
  • the data types corresponding to the weight values of the effective connections of the weight matrix can be stored in a predetermined order (such as a row-by-row order) as a "data type table". Therefore, the data type table is actually a series of ordered data (data type), which can also be regarded as a "one-dimensional matrix” or "sequence".
  • the preset weight values in the weight matrix can include weight value A, weight value B, and weight value C, so that the data volume of each data type in the data type table can be 2bits, such as using 01, 10, and 00 to correspond to three preset weight values (preset value type) of weight value A, weight value B, and weight value C respectively, and use 11 to correspond to a special weight value (special value type).
  • All the special weight values of the above weight matrix (that is, the weight values of all special value types in the corresponding data type table) can also be stored in sequence (in the same order as the data type table) as a special value table. Therefore, the special value table is actually a series of ordered data (special weight values), which can also be regarded as a "one-dimensional matrix” or "sequence".
  • Matrix-based formats require that all elements have the same data precision. Thus, for example, if the data volume of each weight value is 16 bits, then the storage space occupied by the weight matrix with N elements is 16*N bits.
  • each element of the connection matrix can be only 1 or 0, occupying 1 bit storage space, so the storage space occupied by the connection matrix corresponding to the above weight matrix is Nbits.
  • the storage space occupied by the data type table is 20%*2*Nbits.
  • the storage space occupied by the special value table is 5%*16*Nbits.
  • the method of the embodiment of the present disclosure saves storage space. The better the effect. Therefore, the embodiments of the present disclosure are particularly suitable for sparse matrices in which invalid weight values account for a large proportion.
  • the embodiments of the present disclosure may be used in a weight matrix in which the weight values of invalid connections (invalid weight values) account for at least (number ratio among all weight values) 40%, or at least 60%, or at least 80%.
  • the embodiment of the present disclosure may be used to preset a weight matrix whose weight value accounts for at least (ratio of the number of valid connection weight values) 40%, or at least 60%, or at least 80%.
  • connection matrix only has the "connection type” of the weight value
  • data type table only has the "connection type” of the weight value of the effective connection.
  • data type and the data volume of each connection type and data type is obviously much smaller than the data volume of the weight value, so the storage space occupied by the connection matrix and data type table is much smaller than the storage space occupied by the weight matrix; and the special value table and pre-set
  • the weight values are set to be only a few weight values in the weight matrix, so they occupy very little storage space.
  • the storage space occupied by all the actually stored data is much smaller than the storage space occupied by the weight matrix, but actually includes all the information (data) of the weight matrix, thereby greatly saving the storage space.
  • the amount of data per connection type is one bit.
  • the amount of data for each connection type is one bit (1 bit), such as the above 1 or 0.
  • the preset weight value after determining the weight values of multiple valid connections in the weight matrix according to the preset weight value, and storing the preset weight value (S101), it also includes:
  • the selection of preset weight values has a significant impact on the effect of saving storage space. If the preset weight values are too small, there will be too many special weight values, and the storage space occupied by the special value table is too large; and the types of preset weight values are too large. If there are too many, the amount of data for each "data type" will be too large, which in turn will cause the storage space occupied by the data type table to be too large.
  • some of the weight values that appear multiple times can be selected as preset weight values, and the selected preset weight values can be stored to better save storage space Effect.
  • FIG. 5 is a flowchart of a data storage method for a weight matrix provided by an embodiment of the present disclosure.
  • the data storage method of the embodiment of the present disclosure includes:
  • S202 Storage type matrix and special value table.
  • the type matrix has the same structure as the weight matrix, each element of which is the type corresponding to the weight value of the corresponding element in the weight matrix, and the amount of data of a type is less than the amount of data of a weight value; types include special value types and multiple presets Value type; each preset value type corresponds to a preset weight value, special value type corresponds to a special weight value, and other weight values except the preset weight value are special weight values; the special value table includes sequentially set, weight matrix All special weight values in .
  • the corresponding type matrix and special value table are generated, and the type matrix and special value table are stored to reflect the information (data) of the weight matrix for Subsequent brain-inspired computing process is used.
  • each element of the type matrix must correspond to an element in the same relative position in the weight matrix.
  • the value of each element of the type matrix is the "type" to which the weight value of its corresponding element in the weight matrix belongs.
  • weight values that appear repeatedly such as some exciting weight values, inhibitory weight values, empty weights, etc.
  • each weight value that appears multiple times can be defined as a preset weight value , so that it belongs to a "preset value type"; and other weight values in the weight matrix appear less, so they are all defined as special weight values and belong to the "special value type".
  • the special value table In the special value table, all special weight values appearing in the weight matrix are stored in a predetermined order (such as a row-by-row order). Therefore, the special value table is actually a series of ordered data (special weight values), which can also be regarded as a "one-dimensional matrix” or "sequence".
  • the form of the special value table may refer to the special value table shown in Table 3.
  • matrix-based formats require that all elements have the same data precision. For example, if the data volume of each weight value is 16 bits, then the storage space occupied by the weight matrix with N elements is 16*N bits.
  • the preset weights in the weight matrix Values can include weight value A, weight value B, and empty weight (indicated by 0), so that the amount of data of each type in the type matrix can be 2 bits, such as 01, 10, and 00 corresponding to weight value A, weight value B.
  • Null weights are three preset weight values, and 11 corresponds to special weight values.
  • the storage space occupied by the type matrix is 2*Nbits.
  • the storage space occupied by the special value table is 20%*16*Nbits.
  • N is very large, the storage space is far smaller than 16*Nbits, so the method of the embodiment of the present disclosure can greatly save storage space.
  • the embodiment of the present disclosure is especially suitable for
  • the weight matrix for example, is used for a sparse matrix with a large proportion of empty weights (empty weights are one of the preset weight values).
  • the embodiments of the present disclosure may be used to preset a weight matrix in which weight values account for at least (ratio of numbers among all weight values) 40%, or at least 60%, or at least 80%.
  • the type matrix only has the "type" of the weight value, and the data volume of each type is obviously much smaller than the data volume of the weight value. Therefore, the storage space occupied by the type matrix is much smaller than the storage space occupied by the weight matrix; and the special value table and preset weight values are only a few weight values in the weight matrix, so the storage space they occupy is also very small.
  • the storage space occupied by all the actually stored data is much smaller than the storage space occupied by the weight matrix, but actually includes all the information (data) of the weight matrix, thereby greatly saving the storage space.
  • the preset weight value includes: a null weight; and at least one preset, non-null weight value.
  • weight matrices are sparse matrices, that is, the empty weights account for a relatively large proportion (such as at least 40%, or at least 60%, or at least 80%), so the empty weights can be used as a preset weight value, and at the same time There are some other non-null weight values as weight values.
  • type matrix and special value table (S201) before generating type matrix and special value table (S201) according to weight matrix, also include:
  • the selection of preset weight values has a significant impact on the effect of saving storage space. If the preset weight values are too small, there will be too many special weight values, and the storage space occupied by the special value table is too large; and the types of preset weight values are too large. If there are too many, the amount of data for each "type" will be too large, and the storage space occupied by the type matrix will be too large.
  • some of the weight values that appear multiple times can be selected as preset weight values, and the selected preset weight values can be stored to better save storage space Effect.
  • an embodiment of the present disclosure provides a data acquisition method of a weight matrix, which uses the data of the weight matrix stored according to the above method to acquire the required weight values in the weight matrix for subsequent brain-inspired calculation processes.
  • FIG. 8 is a flow chart of a method for obtaining data of a weight matrix provided by an embodiment of the present disclosure.
  • the data acquisition method of the disclosed embodiment includes:
  • Step S31 according to the pre-stored coding array and special value table, determine the weight value of the corresponding element in the weight matrix.
  • Step S32 acquiring the determined weight value.
  • the storage space occupied by the encoding array and the special value table is smaller than the storage space occupied by the weight matrix; the special value table includes all special weight values in the weight matrix set in sequence.
  • the number of encoding arrays is one or more, and the elements in the encoding array are the types of weight values of corresponding elements in the weight matrix, and the data volume of at least some types is smaller than the data volume of the corresponding weight values;
  • the special value table includes a plurality of special weight values in the weight matrix set in sequence, the special weight values include weight values in the weight matrix except the preset weight values, and the preset weight values are preset weight values.
  • the encoding array includes a connectivity matrix and a data type table
  • determine the weight value of the corresponding element in the weight matrix including:
  • connection matrix is the same as that of the weight matrix, and the elements of the connection matrix are the connection types of the weight values of the corresponding elements in the weight matrix; the data volume of at least some connection types is smaller than the data volume of the corresponding weight values, and the connection types are divided into effective connections and invalid connections;
  • the data type table includes sequentially set data types corresponding to the weight values of effective connections in the weight matrix; at least some data types have a data volume smaller than the corresponding weight value data volume, and the data types include special value types and multiple first predetermined Set value type, the first preset value type corresponds to the first preset weight value, the first preset weight value is the preset weight value of the effective connection, the special value type corresponds to the special weight value, except the first preset weight value
  • the weight values of other valid connections are special weight values.
  • the encoding array may also include a type matrix
  • determine the weight value of the corresponding element in the weight matrix including:
  • the type matrix has the same structure as the weight matrix, and the elements of the type matrix are the types of the weight values of the corresponding elements in the weight matrix, and the data volume of at least some types is smaller than the data volume of the corresponding weight values; the types include special value types and multiple The second preset value type; the second preset value type corresponds to the second preset weight value, the special value type corresponds to the special weight value, and other weight values except the second preset weight value belong to the special weight value.
  • the above is only an example of the coding array, and the coding array may also be set in other manners, which is not limited in this embodiment of the present disclosure.
  • FIG. 9 is a flow chart of a method for obtaining data of a weight matrix provided by an embodiment of the present disclosure.
  • the data acquisition method of the weight matrix of the embodiment of the present disclosure includes:
  • connection matrix has the same structure as the weight matrix, and each element is the connection type of the weight value of the corresponding element in the weight matrix; the data volume of a connection type is less than the data volume of a weight value, and the connection type is divided into valid connection and invalid connection ;
  • the data type table includes the data types corresponding to the weight values of effective connections in the weight matrix that are set in sequence; the data volume of a data type is less than the data volume of a weight value, and the data types include special value types and multiple preset value types.
  • a preset value type corresponds to a preset weight value of an effective connection
  • a special value type corresponds to a special weight value
  • the weight values of other valid connections except the preset weight value are special weight values
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • the data of the weight matrix stored in the above method is not the "weight matrix" itself, so when the weight value of an element in the weight matrix needs to be used, it needs to be based on the corresponding element in the connection matrix (elements in the same relative position ) to determine whether the weight value is a valid connection or an invalid connection, and when the weight value is a valid connection, continue to determine the data type of the weight value according to the data type table, and then determine which preset weight value or special value in the weight value table Which special weight value, get its weight value.
  • the corresponding weight value can be directly obtained according to the above method, and directly read and used.
  • the weight value (S401) of the corresponding element in the weight matrix after determining the weight value (S401) of the corresponding element in the weight matrix according to the pre-stored connection matrix, data type table, and special value table, it also includes:
  • weight values of the elements in the weight matrix has nothing to do with how the weight values are subsequently used.
  • the weight values obtained in the following manner can be obtained directly, or can be used to form the above "temporary weight matrix (such as S402, S403)".
  • determining the weight value of the corresponding element in the weight matrix (S401) includes:
  • the address generator sequentially generates the addresses of the elements in the connection matrix, and inputs them into the connection matrix memory.
  • connection matrix memory inputs the connection type of the corresponding element of the connection matrix pre-stored therein to the first gate and data type memory according to the received address.
  • the data type memory When the data type memory receives a valid connection, it inputs the corresponding data type of the pre-stored data type table into the second selector and the special value judger.
  • the preset value memory synchronously inputs the preset weight values prestored therein to the second gate.
  • the special value judger When the received data type is a special value type, the special value judger outputs an update signal to the special value memory.
  • the special value memory inputs the current special weight value of the special value table prestored therein to the second selector, and updates the current special weight value to the next special weight value of the special value table when an update signal is received.
  • the second selector selects an output from the received current special weight value and each preset weight value according to the received data type.
  • the invalid value storage input the invalid weight value pre-stored therein to the first selector.
  • the first gate selects an output from the received invalid weight value and the output of the second gate according to the received connection type.
  • the address generator sequentially (corresponding to the storage order of the data type table and the special value table) generates addresses and inputs them into the connection matrix memory.
  • the address generated above is used to indicate the weight value of which element in the weight matrix needs to be determined currently; therefore, for simplicity, the address of the corresponding element in the weight matrix and the connection matrix may be the same.
  • connection matrix memory inputs the connection type (such as 1 or 0 above) of the element indicated by the address into the first strobe and data type memory.
  • the data type memory stores the corresponding data type of the data type table therein, that is, the data type corresponding to the weight value of the address of the effective connection (such as above 01, 10, 00, 11) are input to the second gate.
  • the data type memory can output "corresponding" data types in various ways, for example, the data type memory can "update” the "next" data type of the output data type table every time it receives "valid connection", Therefore, it is ensured that the ordinal number of the output data type is equal to the ordinal number of the corresponding weight value in the weight values of all valid connections of the weight matrix.
  • connection type received by the data type memory is "invalid connection (such as 0)"
  • it may continue to output the previous data type, or may not output it, which will not be described in detail here.
  • the preset value memory (such as a register) synchronously inputs (such as continuous input) all preset weight values stored therein (such as the above weight value A, weight value B, and weight value C) to the second selector; special The value memory also inputs (eg, continuously inputs) the current special weight value stored therein to the second gate.
  • the second gate simultaneously receives all preset weight values and the current special weight value.
  • the second strobe also receives the data type (from the data type memory) of the element that currently needs to determine the weight value, so that it can determine which weight value should be output according to the data type (for example, the data type is 01 Then output the weight value A, if the data type is 10, then output the weight value B, if the data type is 00, then output the weight value C, if the data type is 11, then output the current special weight value), that is to determine which "way” input gate ; while the weight values of other "roads" received by the second strobe do not correspond to the current element, so they are not output.
  • the data type from the data type memory
  • the second strobe may not generate any output if the second strobe does not receive the data type, it may not generate any output.
  • the data type memory also inputs the data type to the special value judger, and the special value judger outputs an update signal to the special value memory when the received data type is a special value type (such as 11) for special value
  • the memory "updates" the current special weight value, that is, selects the "next" special weight value in the special value table as the new current special weight value, and outputs it to the strobe.
  • the addresses generated by the address generator are “sequentially”, and the data types in the data type table are also “sequentially” in the same way, and the special weight values in the special value table in the special value storage are also “sequentially” in the same way. "in sequence”, thus, by updating the current special weight value when the data type is a special value type, it can be guaranteed that the address and the current special weight value are "synchronized”.
  • the invalid value memory also inputs (as continuous input) the invalid weight value prestored therein (no weight, for example, the weight value is 0) to the first strobe, that is, the first strobe receives the invalid weight value at the same time and the output of the second strobe (preset weight value or current special weight value).
  • the first strobe can select an output from the received invalid weight value and the output of the second strobe according to the received connection type (from the connection matrix memory), for example, after receiving the invalid When connecting, output an invalid weight value, and output the output of the second selector when receiving a valid connection (the preset weight value or the current special weight value, both belong to the valid weight value), so as to realize the accurate output of the invalid weight value.
  • the data acquisition device of the weight matrix includes an acquisition unit, and each acquisition unit includes the above connection matrix memory, data type memory, special value judger, first gate, second selector through device.
  • each acquisition unit further includes: an output enabler connected to the output of the first gate;
  • the device of the embodiment of the present disclosure also includes: a logic controller connected between each special value judger and the special value memory, and connected to each output enabler; the logic controller is configured to send an update signal to the special value memory , and when multiple update signals are received at the same time, the multiple update signals are sequentially input to the special value memory, and the output enablers of the acquisition units corresponding to the update signals are controlled to be sequentially turned on.
  • each acquisition unit can determine the weight value of an element, so if the weight value of multiple elements is to be determined simultaneously in a "parallel" manner (such as the weight values of multiple adjacent elements in a row of the weight matrix), then Multiple acquisition units (two are taken as an example in FIG. 13 ) need to be used at the same time, each acquisition unit works synchronously, and each acquisition unit determines a weight value.
  • the special value memory, preset value memory, and invalid value memory can be "common", that is, they output the current special weight value and preset weight value to all acquisition units synchronously. the second gate, and output invalid weight values to the first gate of all acquisition units, thereby simplifying the hardware structure.
  • the address generator is also "common", the difference is that it inputs the addresses of the elements that each acquisition unit should process to the connection matrix memory of the corresponding acquisition unit (that is, the addresses that are input to each connection matrix memory at the same time are different, but according to sequence), and then the connection matrix memory of each acquisition unit inputs the corresponding connection type to the first gate and data type memory of the acquisition unit where it is located, so that the first gate can output the weight value of the corresponding element.
  • a logic controller and an output enabler also need to be set.
  • the logic controller can directly forward it to the special value memory.
  • the logic controller when there are multiple special weight values in the weight values of multiple elements output in parallel, the logic controller must receive multiple update signals (such as two update signals) at the same time, so it needs to input the update signals to Special value memory (for example, input the first update signal to the special value memory first, and then input the second update signal to the special value memory after a certain period of time). Furthermore, the special value memory will update the current special weight value multiple times, and output different current special weight values at different times (such as outputting the first update signal before receiving the second update signal after receiving the first update signal) the current special weight value; and output the second current special weight value after receiving the second update signal).
  • Special value memory for example, input the first update signal to the special value memory first, and then input the second update signal to the special value memory after a certain period of time.
  • the special value memory will update the current special weight value multiple times, and output different current special weight values at different times (such as outputting the first update signal before receiving the second update signal after receiving the first update signal) the current special weight value; and output
  • the logic controller when multiple update signals are received at the same time, the logic controller also needs to control the output enablers of the acquisition units corresponding to each update signal to be turned on sequentially in a polling manner (for example, when the special value memory outputs the first When the current special weight value is present, the output enabler of the acquisition unit corresponding to the first update signal is turned on, and the output enabler of the acquisition unit corresponding to the second update signal is turned off; and the special value memory outputs the second When the current special weight value is set, the output enabler of the acquisition unit corresponding to the second update signal is turned on, and the output enabler of the acquisition unit corresponding to the first update signal is turned off).
  • a polling manner for example, when the special value memory outputs the first When the current special weight value is present, the output enabler of the acquisition unit corresponding to the first update signal is turned on, and the output enabler of the acquisition unit corresponding to the second update signal is turned off; and the special value memory outputs the second When the current special weight value is set, the output enable
  • multiple acquisition units corresponding to each update signal can respectively output ("parallel" output, but not completely “simultaneously") the special weight values of the respective corresponding elements.
  • the logic controller when multiple update signals are received at the same time, the logic controller should control the output enablers of other acquisition units that do not correspond to the update signal to remain in the conduction state; and when only one update signal is received at the same time or no update signal is received , the logic controller should control the output enablers of all acquisition units to remain on, and will not be described in detail here
  • the logic controller can adjust the working state periodically through the multiplier and adder, which will not be described in detail here.
  • the encoding array may also include a type matrix.
  • FIG. 14 is a flow chart of a method for obtaining data of a weight matrix provided by an embodiment of the present disclosure.
  • the method for obtaining data of the weight matrix of the embodiment of the present disclosure includes:
  • the type matrix has the same structure as the weight matrix, each element of which is the type corresponding to the weight value of the corresponding element in the weight matrix, and the amount of data of a type is less than the amount of data of a weight value; types include special value types and multiple presets Value type; each preset value type corresponds to a preset weight value, special value type corresponds to a special weight value, and other weight values except the preset weight value are special weight values; the special value table includes sequentially set, weight matrix All special weight values in .
  • the data of the weight matrix stored in the above method is not the "weight matrix" itself, so when the weight value of an element in the weight matrix needs to be used, it needs to be based on the corresponding element in the type matrix (the element in the same relative position) Type, determine which weight value it corresponds to, and then determine its corresponding special weight value or preset weight value according to the special value table and preset weight value.
  • the weight value (S501) of the corresponding element in the weight matrix after determining the weight value (S501) of the corresponding element in the weight matrix according to the type of the element of the pre-stored type matrix, and the pre-stored special value table and preset weight value, it also includes:
  • the corresponding weight value can be directly obtained according to the above method, and directly read and used.
  • the pre-stored special value table and preset weight value (S501) after determining the weight value of the corresponding element in the weight matrix (S501) according to the type of the element of the pre-stored type matrix, and the pre-stored special value table and preset weight value (S501), it also includes:
  • weight values obtained in the following manner can be obtained directly (such as S502), or can be used to form the above "temporary weight matrix (such as S503, S504)".
  • determining the weight value of the corresponding element in the weight matrix (S501) includes:
  • the address generator sequentially generates the addresses of the elements in the type matrix, and inputs them into the type matrix memory.
  • the preset value memory synchronously inputs the preset weight values prestored therein to the third gate.
  • the type matrix memory inputs the types of the corresponding elements of the type matrix prestored therein to the third selector and special value judger according to the received address.
  • the special value judger outputs an update signal to the special value memory when the received type is a special value type.
  • the special value memory inputs the current special weight value of the special value table prestored therein to the third selector, and updates the current special weight value to the next special weight value of the special value table when an update signal is received.
  • the third selector selects an output from the received current special weight value and each preset weight value according to the received type.
  • the address generator sequentially (corresponding to the storage order of special weight values in the special value table) generates addresses and inputs them into the type matrix memory.
  • the address generated above is used to indicate the weight value of which element in the weight matrix needs to be determined currently; therefore, for simplicity, the address of the corresponding element in the weight matrix and the type matrix may be the same.
  • the type matrix memory inputs the type of the element indicated by the address (such as 01, 10, 00, 11 above) to the third gate according to the received address.
  • the preset value memory (such as a register) then synchronously inputs (such as continuous input) all preset weight values stored therein (such as the above weight value A, weight value B, 0) to the third strobe; special value
  • the memory also inputs (for example, continuously inputs) the current special weight value stored therein to the third gate.
  • the third strobe receives all preset weight values and the current special weight value at the same time; at the same time, the third strobe also receives the type of the element whose weight value needs to be determined currently, so that it can, according to the type, Determine which weight value should be output (for example, if the type is 01, the weight value A will be output, if the type is 10, the weight value B will be output, if the type is 00, 0 will be output, and if the type is 11, the current special weight value will be output), that is, determine the The input gate of which "road” is output as the weight value of the current element; and the weight values of other "roads" received by the third gating device do not correspond to the current element, so they are not output.
  • the type Determine which weight value should be output (for example, if the type is 01, the weight value A will be output, if the type is 10, the weight value B will be output, if the type is 00, 0 will be output, and if the type is 11, the current
  • the type matrix memory also inputs the type to the special value judger, and the special value judger outputs an update signal to the special value memory when the received type is a special value type (such as 11), for the special value memory " Updating" the current special weight value, that is, selecting the "next" special weight value in the special value table as the new current special weight value, and outputting it to the third gate.
  • a special value type such as 11
  • the addresses generated by the address generator are “sequentially” and the special weight values in the special value table in the special value memory are also arranged “sequentially” in the same way, thus, by updating when the type is a special value type
  • the current special weight value can ensure that the address is "synchronized” with the current special weight value, that is, it is guaranteed that the output special weight value must be the special weight value actually corresponding to the current element.
  • the device for acquiring weight matrix data includes an acquisition unit, and each acquisition unit includes the above type matrix memory, a special value judger, and a third gate.
  • each acquisition unit further includes: an output enabler connected to the output of the third gate;
  • the data acquisition device of the weight matrix also includes: a logic controller, which is connected between each special value judger and the special value memory, and connected to each output enabler; the logic controller is configured to send the update signal to the special When multiple update signals are received at the same time, the multiple update signals are sequentially input into the special value memory, and the output enablers of each acquisition unit corresponding to each update signal are controlled to be sequentially turned on.
  • each acquisition unit can determine the weight value of an element, so if the weight value of multiple elements is to be determined simultaneously in a "parallel" manner (such as the weight values of multiple adjacent elements in a row of the weight matrix), then Multiple acquisition units (two are taken as an example in FIG. 18 ) need to be used at the same time, each acquisition unit works synchronously, and each acquisition unit determines a weight value.
  • the special value memory and the preset value memory can be "common", that is, they output the current special weight value and the preset weight value synchronously to the third gate of all acquisition units , thereby simplifying the hardware structure.
  • the address generator is also "common", and the difference is that it inputs the addresses of the elements that each acquisition unit should process to the type matrix memory of the corresponding acquisition unit (that is, the addresses that are input to each type of matrix memory at the same time are different, but according to sequence), and then the type matrix memory of each acquisition unit inputs the corresponding type to the third gate of its own acquisition unit, so that the third gate can output the weight value of the corresponding element.
  • a logic controller and an output enabler also need to be set.
  • the logic controller can directly forward it to the special value memory.
  • the logic controller when there are multiple special weight values in the weight values of multiple elements output in parallel, the logic controller must receive multiple update signals (such as two update signals) at the same time, so it needs to input the update signals to Special value memory (for example, input the first update signal to the special value memory first, and then input the second update signal to the special value memory after a certain period of time). Furthermore, the special value memory will update the current special weight value multiple times, and output different current special weight values at different times (such as outputting the first update signal before receiving the second update signal after receiving the first update signal) the current special weight value; and output the second current special weight value after receiving the second update signal).
  • Special value memory for example, input the first update signal to the special value memory first, and then input the second update signal to the special value memory after a certain period of time.
  • the special value memory will update the current special weight value multiple times, and output different current special weight values at different times (such as outputting the first update signal before receiving the second update signal after receiving the first update signal) the current special weight value; and output
  • the logic controller when multiple update signals are received at the same time, the logic controller also needs to control the output enablers of the acquisition units corresponding to each update signal to be turned on sequentially in a polling manner (for example, when the special value memory outputs the first When the current special weight value is present, the output enabler of the acquisition unit corresponding to the first update signal is turned on, and the output enabler of the acquisition unit corresponding to the second update signal is turned off; and the special value memory outputs the second When the current special weight value is set, the output enabler of the acquisition unit corresponding to the second update signal is turned on, and the output enabler of the acquisition unit corresponding to the first update signal is turned off).
  • a polling manner for example, when the special value memory outputs the first When the current special weight value is present, the output enabler of the acquisition unit corresponding to the first update signal is turned on, and the output enabler of the acquisition unit corresponding to the second update signal is turned off; and the special value memory outputs the second When the current special weight value is set, the output enable
  • multiple acquisition units corresponding to each update signal can respectively output ("parallel" output, but not completely “simultaneously") the special weight values of the respective corresponding elements.
  • the logic controller when multiple update signals are received at the same time, the logic controller should control the output enablers of other acquisition units that do not correspond to the update signal to remain in the conduction state; and when only one update signal is received at the same time or no update signal is received , the logic controller should control the output enablers of all acquisition units to remain on, and will not be described in detail here
  • the logic controller can adjust the working state periodically through the multiplier and adder, which will not be described in detail here.
  • an embodiment of the present disclosure provides an apparatus for acquiring data of a weight matrix.
  • FIG. 19 is a block diagram of an apparatus for acquiring data of a weight matrix provided by an embodiment of the present disclosure.
  • the data acquisition device of the embodiment of the present disclosure includes: a processing unit 1901 and at least one acquisition unit 1902;
  • the processing unit 1901 is configured to determine the weight value of the corresponding element in the weight matrix according to the pre-stored coding array and special value table;
  • the obtaining unit 1902 is configured to obtain the determined weight value
  • the storage space occupied by the encoding array and the special value table is smaller than the storage space occupied by the weight matrix; the special value table includes all special weight values in the weight matrix set in sequence.
  • FIG. 12 it provides an apparatus for acquiring weight matrix data according to an embodiment of the present disclosure, which includes an address generator, a special value memory, an invalid value memory, a preset value memory, and at least one acquisition unit; in,
  • the address generator is configured to sequentially generate the addresses of the elements in the connection matrix, and input them to the connection matrix memory of the corresponding acquisition unit;
  • the preset value memory is configured to store all preset weight values, and input each preset weight value to the second gates of all acquisition units synchronously;
  • the invalid value memory is configured to store the invalid weight value and input to the first gates of all the acquisition units
  • the special value memory is configured to store a special value table, input the current special weight value of the special value table to the second gate, and update the current special weight value to the next special weight of the special value table when an update signal is received value;
  • Each acquisition unit includes:
  • connection matrix memory configured to store the connection matrix and input the connection type of the corresponding element of the connection matrix to the first gate and data type memory according to the received address
  • the data type memory is configured to input the corresponding data type of the prestored data type table into the second gate and the special value judger when a valid connection is received;
  • the special value judger is configured to output an update signal to the special value memory when the received data type is a special value type
  • the second gate is configured to select an output from the received current special weight value and each preset weight value according to the received data type
  • a first gate configured to select an output from the received invalid weight value, the output of the second gate, based on the type of connection received
  • connection matrix has the same structure as the weight matrix, and each element is the connection type of the weight value of the corresponding element in the weight matrix; the data volume of a connection type is less than the data volume of a weight value, and the connection type is divided into valid connection and invalid connection ;
  • the data type table includes the data types corresponding to the weight values of effective connections in the weight matrix that are set in sequence; the data volume of a data type is less than the data volume of a weight value, and the data types include special value types and multiple preset value types.
  • a preset value type corresponds to a preset weight value of an effective connection
  • a special value type corresponds to a special weight value
  • the weight values of other valid connections except the preset weight value are special weight values
  • the special value table includes all special weight values in the weight matrix set in sequence.
  • the number of acquisition units is multiple;
  • Each acquisition unit also includes: an output enabler connected to the output of the first selector;
  • the device also includes: a logic controller, which is connected between each special value judger and the special value memory, and connected to each output enabler; the logic controller is configured to send an update signal to the special value memory, and at the same time receive When multiple update signals are received, the multiple update signals are sequentially input to the special value memory, and the output enablers of the acquisition units corresponding to the update signals are controlled to be sequentially turned on.
  • a logic controller which is connected between each special value judger and the special value memory, and connected to each output enabler; the logic controller is configured to send an update signal to the special value memory, and at the same time receive When multiple update signals are received, the multiple update signals are sequentially input to the special value memory, and the output enablers of the acquisition units corresponding to the update signals are controlled to be sequentially turned on.
  • the device in the embodiment of the present disclosure can realize the above method for obtaining data of the weight matrix through the above hardware structure, which will not be described in detail here.
  • multiple structures may be multiple independent physical devices, or multiple structures may be integrated and realized by one physical device, which will not be described in detail here.
  • FIG. 17 it provides an apparatus for acquiring weight matrix data according to an embodiment of the present disclosure, including an address generator, a special value memory, a preset value memory, and at least one acquisition unit; wherein,
  • the address generator is configured to sequentially generate the addresses of the elements in the type matrix, and input them into the type matrix memory of the corresponding acquisition unit;
  • the preset value memory is configured to store all preset weight values, and input each preset weight value to the third gates of all acquisition units synchronously;
  • the special value memory is configured to store a special value table, input the current special weight value of the special value table to the third gate, and update the current special weight value to the next special weight of the special value table when an update signal is received value;
  • Each acquisition unit includes:
  • the type matrix memory is configured to store the type matrix, and according to the received address, input the type of the corresponding element of the type matrix to the third gate and the special value judger;
  • the special value judger is configured to output an update signal to the special value memory when the received type is a special value type
  • the third gate is configured to select an output from the received current special weight value and each preset weight value according to the received type
  • the type matrix has the same structure as the weight matrix, each element of which is the type corresponding to the weight value of the corresponding element in the weight matrix, and the amount of data of a type is less than the amount of data of a weight value; types include special value types and multiple presets Value type; each preset value type corresponds to a preset weight value, special value type corresponds to a special weight value, and other weight values except the preset weight value are special weight values; the special value table includes sequentially set, weight matrix All special weight values in .
  • the number of acquisition units is multiple;
  • Each acquisition unit also includes: an output enabler connected to the output of the third gate;
  • the device also includes: a logic controller, which is connected between each special value judger and the special value memory, and connected to each output enabler; the logic controller is configured to send an update signal to the special value memory, and at the same time receive When multiple update signals are received, the multiple update signals are sequentially input to the special value memory, and the output enablers of the acquisition units corresponding to the update signals are controlled to be sequentially turned on.
  • a logic controller which is connected between each special value judger and the special value memory, and connected to each output enabler; the logic controller is configured to send an update signal to the special value memory, and at the same time receive When multiple update signals are received, the multiple update signals are sequentially input to the special value memory, and the output enablers of the acquisition units corresponding to the update signals are controlled to be sequentially turned on.
  • the device in the embodiment of the present disclosure can realize the above method for obtaining data of the weight matrix through the above hardware structure, which will not be described in detail here.
  • multiple structures may be multiple independent physical devices, or multiple structures may be integrated and realized by one physical device, which will not be described in detail here.
  • Fig. 20 is a block diagram of an electronic device provided by an embodiment of the present disclosure.
  • an embodiment of the present disclosure provides an electronic device, which includes: at least one processor 2001; at least one memory 2002, and one or more I/O interfaces 2003 connected between the processor 2001 and the memory 2002 Among them; wherein, the memory 2002 stores one or more computer programs that can be executed by at least one processor 2001, and one or more computer programs are executed by at least one processor 2001, so that at least one processor 2001 can perform the above-mentioned The data storage method of the weight matrix, or the data acquisition method of the weight matrix.
  • An embodiment of the present disclosure also provides a computer-readable storage medium on which a computer program is stored, wherein, when the computer program is executed by a processor/processing core, the above-mentioned data storage method of the weight matrix, or the weight matrix data acquisition method.
  • Computer readable storage media may be volatile or nonvolatile computer readable storage media.
  • An embodiment of the present disclosure also provides a computer program product, including computer-readable codes, or a non-volatile computer-readable storage medium carrying computer-readable codes, when the computer-readable codes are stored in a processor of an electronic device When running in the electronic device, the processor in the electronic device executes the above data storage method of the weight matrix, or the data acquisition method of the weight matrix.
  • the functional modules/units in the system, and the device can be implemented as software, firmware, hardware, and an appropriate combination thereof.
  • the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be composed of several physical components. Components cooperate to execute.
  • Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit .
  • Such software may be distributed on computer readable storage media, which may include computer storage media (or non-transitory media) and communication media (or transitory media).
  • Computer storage media includes both volatile and nonvolatile media implemented in any method or technology for storage of information, such as computer readable program instructions, data structures, program modules, or other data. volatile, removable and non-removable media.
  • Computer storage media include, but are not limited to, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable Compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disk storage, magnetic cartridge, magnetic tape, magnetic disk storage or other magnetic storage device, or any other device that can be used to store desired information and can be accessed by a computer any other medium.
  • communication media typically embodies computer-readable program instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery medium.
  • Computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or downloaded to an external computer or external storage device over a network, such as the Internet, a local area network, a wide area network, and/or a wireless network.
  • the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
  • a network adapter card or a network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
  • Computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or Source or object code written in any combination, including object-oriented programming languages—such as Smalltalk, C++, etc., and conventional procedural programming languages—such as the “C” language or similar programming languages.
  • Computer readable program instructions 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 server implement.
  • the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as via the Internet using an Internet service provider). connect).
  • LAN local area network
  • WAN wide area network
  • an electronic circuit such as a programmable logic circuit, field programmable gate array (FPGA), or programmable logic array (PLA)
  • FPGA field programmable gate array
  • PDA programmable logic array
  • the computer program products described herein can be realized by hardware, software or a combination thereof.
  • the computer program product is exemplarily embodied as a computer storage medium, and in another optional embodiment, the computer program product is exemplarily embodied as a software product, such as a software development kit (Software Development Kit , SDK) and so on.
  • a software development kit Software Development Kit , SDK
  • These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine such that when executed by the processor of the computer or other programmable data processing apparatus , producing an apparatus for realizing the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
  • These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause computers, programmable data processing devices and/or other devices to work in a specific way, so that the computer-readable medium storing instructions includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks in flowcharts and/or block diagrams.
  • each block in a flowchart or block diagram may represent a module, a portion of a program segment, or an instruction that includes one or more Executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified function or action , or may be implemented by a combination of dedicated hardware and computer instructions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Human Computer Interaction (AREA)
  • Neurology (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

一种权重矩阵的数据存储方法、数据获取方法及装置、设备。权重矩阵的数据存储方法包括:根据权重矩阵,生成编码阵列和特殊值表;存储编码阵列和特殊值表;其中,编码阵列和特殊值表所占用的存储空间小于权重矩阵所占用的存储空间。

Description

权重矩阵的数据存储方法、数据获取方法及装置、设备 技术领域
本公开实施例涉及人工智能技术领域,尤其涉及一种权重矩阵的数据存储方法、数据获取方法及装置、电子设备、计算机可读存储介质。
背景技术
类脑计算技术已被广泛应用于智能科学、认知科学、信息处理、人工智能等领域,可用于对文本、图像、音视频等进行识别与处理。
人脑包括大量(如1000亿左右)的神经元,而类脑芯片(神经形态芯片)则通过设置大量的电子模拟的神经元模拟人脑的工作。神经元在工作过程中需要用到很多的“权重(如连接权重)”,这些权重可以“权重矩阵”的形式存在,权重矩阵的每个元素为一个权重值(如一个连接的权重值)。
发明内容
本公开实施例提供一种权重矩阵的数据存储方法、数据获取方法及装置、电子设备、计算机可读存储介质,其可以有效减少权重矩阵所占用的存储空间。
第一方面,本公开实施例提供一种权重矩阵的数据存储方法,包括:
根据权重矩阵,生成编码阵列和特殊值表;
存储所述编码阵列和所述特殊值表;
其中,所述编码阵列和所述特殊值表所占的存储空间小于所述权重矩阵所占的存储空间;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
在一些实施例中,所述编码阵列包括连接矩阵和数据类型表;
其中,所述连接矩阵与所述权重矩阵结构相同,且所述连接矩阵的元素为所述权重矩阵中对应元素的权重值的连接类型;至少部分所述连接类型的数据量小于对应的权重值的数据量,且所述连接类型分为有效连接和无效连接;
所述数据类型表包括依次设置的、所述权重矩阵中有效连接的权重值对应的数据类型;至少部分所述数据类型的数据量小于对应的权重值的数据量,且所述数据类型包括特殊值型和多个第一预设值型,所述第一预设值型对应第一预设权重值,所述第一预设权重值为有效连接的预设权重值,所述特殊值型对应所述特殊权重值,除所述第一预设权重值外的其它有效连接的权重值属于特殊权重值。
在一些实施例中,所述编码阵列包括类型矩阵;
其中,所述类型矩阵与所述权重矩阵结构相同,且所述类型矩阵的元素为所述权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;所述类型包括特殊值型和多个第二预设值型;所述第二预设值型对应第二预设权重值,所述特殊值型对应所述特殊权重值,除所述第二预设权重值外的其它权重值属于特殊权 重值。
第二方面,本公开实施例提供一种权重矩阵的数据存储方法,包括:
根据权重矩阵生成连接矩阵、数据类型表、特殊值表;
存储所述连接矩阵、数据类型表、特殊值表;
其中,连接矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值的连接类型;一个连接类型的数据量小于一个权重值的数据量,连接类型分为有效连接和无效连接;
数据类型表包括依次设置的、权重矩阵中有效连接的权重值对应的数据类型;一个数据类型的数据量小于一个权重值的数据量,数据类型包括特殊值型和多个预设值型,每个预设值型对应一个有效连接的预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它有效连接的权重值均为特殊权重值;
特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
第三方面,本公开实施例提供一种权重矩阵的数据存储方法,包括:
根据权重矩阵生成类型矩阵和特殊值表;
存储所述类型矩阵和特殊值表;
其中,所述类型矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值对应的类型,一个类型的数据量小于一个权重值的数据量;所述类型包括特殊值型和多个预设值型;每个所述预设值型对应一个预设权重值,所述特殊值型对应特殊权重值,除所述预设权重值外的其它权重值均为特殊权重值;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
第四方面,本公开实施例提供一种权重矩阵的数据获取方法,包括:
根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值;
获取所述确定的权重值;
其中,所述编码阵列和所述特殊值表所占的存储空间小于所述权重矩阵所占的存储空间;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
在一些实施例中,所述编码阵列包括连接矩阵和数据类型表;
其中,所述连接矩阵与所述权重矩阵结构相同,且所述连接矩阵的元素为所述权重矩阵中对应元素的权重值的连接类型;至少部分所述连接类型的数据量小于对应的权重值的数据量,且所述连接类型分为有效连接和无效连接;
所述数据类型表包括依次设置的、所述权重矩阵中有效连接的权重值对应的数据类型;至少部分所述数据类型的数据量小于对应的权重值的数据量,且所述数据类型包括特殊值型和多个第一预设值型,所述第一预设值型对应第一预设权重值,所述第一预设权重值为有效连接的预设权重值,所述特殊值型对应所述特殊权重值,除所述第一预设权重值外的其它有效连接的权重值属于特殊权重值。
在一些实施例中,所述编码阵列包括类型矩阵;
其中,所述类型矩阵与所述权重矩阵结构相同,且所述类型矩阵的元素为所述权重 矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;所述类型包括特殊值型和多个第二预设值型;所述第二预设值型对应所述第二预设权重值,所述特殊值型对应所述特殊权重值,除所述第二预设权重值外的其它权重值属于特殊权重值。
第五方面,本公开实施例提供一种权重矩阵的数据获取方法,包括:
根据预存的连接矩阵、数据类型表、特殊值表,确定权重矩阵中对应元素的权重值;
其中,连接矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值的连接类型;一个连接类型的数据量小于一个权重值的数据量,连接类型分为有效连接和无效连接;
数据类型表包括依次设置的、权重矩阵中有效连接的权重值对应的数据类型;一个数据类型的数据量小于一个权重值的数据量,数据类型包括特殊值型和多个预设值型,每个预设值型对应一个有效连接的预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它有效连接的权重值均为特殊权重值;
特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
第六方面,本公开实施例提供一种权重矩阵的数据获取方法,包括:
根据预存的类型矩阵的元素的类型,以及预存的特殊值表、预设权重值,确定权重矩阵中对应元素的权重值;
其中,所述类型矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值对应的类型,一个类型的数据量小于一个权重值的数据量;所述类型包括特殊值型和多个预设值型;每个所述预设值型对应一个预设权重值,所述特殊值型对应特殊权重值,除所述预设权重值外的其它权重值均为特殊权重值;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
第七方面,本公开实施例提供一种权重矩阵的数据获取装置,包括:处理单元以及至少一个获取单元;
所述处理单元,被配置为根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值;
所述获取单元,被配置为获取所述确定的权重值;
其中,所述编码阵列和所述特殊值表所占的存储空间小于所述权重矩阵所占的存储空间;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
在一些实施例中,所述编码阵列包括连接矩阵和数据类型表,所述处理单元包括:地址产生器、特殊值存储器、无效值存储器、第一预设值存储器;其中,所述连接矩阵与所述权重矩阵结构相同,且所述连接矩阵的元素为所述权重矩阵中对应元素的权重值的连接类型;至少部分所述连接类型的数据量小于对应的权重值的数据量,且所述连接类型分为有效连接和无效连接;所述数据类型表包括依次设置的、所述权重矩阵中有效连接的权重值对应的数据类型;至少部分所述数据类型的数据量小于对应的权重值的数据量,且所述数据类型包括特殊值型和多个第一预设值型,所述第一预设值型对应第一 预设权重值,所述第一预设权重值为有效连接的预设权重值,所述特殊值型对应所述特殊权重值,除所述第一预设权重值外的其它有效连接的权重值属于特殊权重值;
所述地址产生器被配置为依次产生所述连接矩阵中的元素的地址,并输入至相应获取单元的连接矩阵存储器;
所述第一预设值存储器被配置为存储所述第一预设权重值,并将所述第一预设权重值同步输入至所述获取单元的第二选通器;
所述无效值存储器被配置为存储所述无效权重值,并输入至所述获取单元的第一选通器;
所述特殊值存储器被配置为存储所述特殊值表,将所述特殊值表的当前特殊权重值输入至所述第二选通器,并在接收到更新信号的情况下将当前特殊权重值更新为特殊值表的下一个特殊权重值;
所述获取单元包括:
连接矩阵存储器,被配置为存储所述连接矩阵,并根据接收到的地址,将所述连接矩阵的相应元素的连接类型输入至第一选通器和数据类型存储器;
所述数据类型存储器,被配置为在接收到有效连接的情况下,将其中预存的数据类型表的相应数据类型输入至所述第二选通器和特殊值判断器;
所述特殊值判断器,被配置为在接收到的数据类型为特殊值型的情况下,向特殊值存储器输出更新信号;
所述第二选通器,被配置为根据接收到的数据类型,从接收到的当前特殊权重值、所述第一预设权重值中选择一个输出;
所述第一选通器,被配置为根据接收到的连接类型,从接收到的无效权重值、第二选通器的输出中选择一个输出。
在一些实施例中,所述编码阵列包括类型矩阵,所述处理单元包括:地址产生器、特殊值存储器、第二预设值存储器;其中,所述类型矩阵与所述权重矩阵结构相同,且所述类型矩阵的元素为所述权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;所述类型包括特殊值型和多个第二预设值型;所述第二预设值型对应第二预设权重值,所述特殊值型对应所述特殊权重值,除所述第二预设权重值外的其它权重值属于特殊权重值;
所述地址产生器被配置为依次产生所述类型矩阵中的元素的地址,并输入至相应获取单元的类型矩阵存储器;
所述第二预设值存储器被配置为存储所述第二预设权重值,并将所述第二预设权重值同步输入至所述获取单元的第三选通器;
所述特殊值存储器被配置为存储所述特殊值表,将所述特殊值表的当前特殊权重值输入至所述第三选通器,并在接收到更新信号的情况下将当前特殊权重值更新为所述特殊值表的下一个特殊权重值;
所述获取单元包括:
类型矩阵存储器,被配置为存储类型矩阵,并根据接收到的地址,将所述类型矩阵的相应元素的类型输入至所述第三选通器和特殊值判断器;
所述特殊值判断器,被配置为在接收到的类型为特殊值型的情况下,向所述特殊值存储器输出更新信号;
所述第三选通器,被配置为根据接收到的类型,从接收到的当前特殊权重值、所述第二预设权重值中选择一个输出。
第八方面,本公开实施例提供一种权重矩阵的数据获取装置,包括地址产生器、特殊值存储器、无效值存储器、预设值存储器,以及至少一个获取单元;其中,
所述地址产生器用于依次产生连接矩阵中各元素的地址,并输入至相应获取单元的连接矩阵存储器;
所述预设值存储器用于存储所有预设权重值,并将各预设权重值同步输入至所有获取单元的第二选通器;
所述无效值存储器用于存储无效权重值,并输入至所有获取单元的第一选通器;
所述特殊值存储器用于存储特殊值表,将特殊值表的当前特殊权重值输入至第二选通器,并在接收到更新信号时将当前特殊权重值更新为特殊值表的下一个特殊权重值;
每个所述获取单元包括:
连接矩阵存储器,用于存储连接矩阵,并根据接收到的地址,将连接矩阵的相应元素的连接类型输入至第一选通器和数据类型存储器;
数据类型存储器,用于在接收到有效连接时,将其中预存的数据类型表的相应数据类型输入至第二选通器和特殊值判断器;
特殊值判断器,用于在接收到的数据类型为特殊值型时,向特殊值存储器输出更新信号;
第二选通器,用于根据接收到的数据类型,从接收到的当前特殊权重值、各预设权重值中选择一个输出;
第一选通器,用于根据接收到的连接类型,从接收到的无效权重值、第二选通器的输出中选择一个输出;
其中,连接矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值的连接类型;一个连接类型的数据量小于一个权重值的数据量,连接类型分为有效连接和无效连接;
数据类型表包括依次设置的、权重矩阵中有效连接的权重值对应的数据类型;一个数据类型的数据量小于一个权重值的数据量,数据类型包括特殊值型和多个预设值型,每个预设值型对应一个有效连接的预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它有效连接的权重值均为特殊权重值;
特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
第九方面,本公开实施例提供一种权重矩阵的数据获取装置,包括地址产生器、特殊值存储器、预设值存储器,以及至少一个获取单元;其中,
所述地址产生器用于依次产生类型矩阵中各元素的地址,并输入至相应获取单元的类型矩阵存储器;
所述预设值存储器用于存储所有预设权重值,并将各预设权重值同步输入至所有获取单元的选通器;
所述特殊值存储器用于存储特殊值表,将特殊值表的当前特殊权重值输入至选通器,并在接收到更新信号时将当前特殊权重值更新为特殊值表的下一个特殊权重值;
每个所述获取单元包括:
类型矩阵存储器,用于存储类型矩阵,并根据接收到的地址,将类型矩阵的相应元素的类型输入至选通器和特殊值判断器;
特殊值判断器,用于在接收到的类型为特殊值型时,向特殊值存储器输出更新信号;
选通器,用于根据接收到的类型,从接收到的当前特殊权重值、各预设权重值中选择一个输出;
其中,所述类型矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值对应的类型,一个类型的数据量小于一个权重值的数据量;所述类型包括特殊值型和多个预设值型;每个所述预设值型对应一个预设权重值,所述特殊值型对应特殊权重值,除所述预设权重值外的其它权重值均为特殊权重值;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
第十方面,本公开实施例提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现本公开实施例任意一种权重矩阵的数据存储方法或权重矩阵的数据获取方法。
第十一方面,本公开实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现本公开实施例任意一种权重矩阵的数据存储方法或权重矩阵的数据获取方法。
在本公开实施例中,实际存储的可以包括编码阵列、特殊值表和预设权重值,其中,编码阵列的元素只有权重值的类型,而每个类型的数据量显然远小于权重值的数据量,故编码阵列占用的存储空间远小于权重矩阵占用的存储空间;而特殊值表和预设权重值只是权重矩阵中很少的权重值,故它们占用的存储空间也很小。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。
附图说明
图1为本公开实施例提供的一种权重矩阵的数据存储方法的流程图;
图2为本公开实施例提供的一种权重矩阵的数据存储方法的流程图;
图3为本公开实施例提供的一种权重矩阵与连接矩阵的对应关系图;
图4为本公开实施例提供的一种权重矩阵的数据存储方法的流程图;
图5为本公开实施例提供的一种权重矩阵的数据存储方法的流程图;
图6为本公开实施例提供的一种权重矩阵与类型矩阵的对应关系图;
图7为本公开实施例提供的一种权重矩阵的数据存储的方法的流程图;
图8为本公开实施例提供的一种权重矩阵的数据获取方法的流程图;
图9为本公开实施例提供的一种权重矩阵的数据获取方法的流程图;
图10为本公开实施例提供的一种权重矩阵的数据获取方法的流程图;
图11为本公开实施例提供的一种权重矩阵的数据获取方法的流程图;
图12为本公开实施例提供的一种权重矩阵的数据获取装置的组成框图;
图13为本公开实施例提供的另一种权重矩阵的数据获取装置的组成框图;
图14为本公开实施例提供的一种权重矩阵的数据获取方法的流程图;
图15为本公开实施例提供的另一种权重矩阵的数据获取方法的流程图;
图16为本公开实施例提供的另一种权重矩阵的数据获取方法的流程图;
图17为本公开实施例提供的一种权重矩阵的数据获取装置的组成框图;
图18为本公开实施例提供的另一种权重矩阵的数据获取装置的组成框图;
图19为本公开实施例提供的一种权重矩阵的数据获取装置的框图;
图20为本公开实施例提供的一种电子设备的框图。
具体实施方式
下面结合附图和实施例对本公开作进一步的详细说明。可以理解的是,此处所描述的实施例仅仅用于解释本公开,而非对本公开的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本公开相关的部分而非全部结构。
第一方面,本公开实施例提供一种权重矩阵的数据存储方法,其用于将权重矩阵的数据(信息)存储下来,以供后续的类脑计算过程使用。
其中,权重矩阵用于存储类脑计算中用的权重(如神经元的权重)。权重矩阵可为二维形式,也可为更高维度的形式,且其中的每个元素为一个权重值。
其中,权重矩阵中所有权重值的精度是相同的,例如为int8、fp16等形式。
图1为本公开实施例提供的一种权重矩阵的数据存储方法的流程图。参照图1,本公开实施例的数据存储方法包括:
在步骤S11中,根据权重矩阵,生成编码阵列和特殊值表。
在步骤S12中,存储编码阵列和特殊值表。
其中,编码阵列和特殊值表所占的存储空间小于权重矩阵所占的存储空间;上述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
在一些可选的实现方式中,编码阵列的数量为一个或多个,且编码阵列中的元素为权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;特殊值表包括依次设置的、权重矩阵中的多个特殊权重值,特殊权重值包括权重矩阵中除预设权重值之外的权重值,预设权重值为预先预设的权重值。
在神经网络中,部分神经元处于休眠状态,相当于处于无效连接,而部分神经元处于非休眠状态,其可能是抑制的或兴奋的。在进行脑仿真等操作时,通过较为有限的若干种取值即可表征神经元的权重值。在一些可能的实现方式中,考虑到单个权重值占用数据量较大,且存在多个权重值具有相同取值,从而导致权重矩阵数据量较大的问题,因此,可以通过对权重矩阵中的权重值进行先编码再存储的方式,来降低权重矩阵所占用的存储空间。在一些可选的实现方式中,编码阵列可以包括连接矩阵和数据类型表。
其中,连接矩阵与权重矩阵结构相同,且连接矩阵的元素为权重矩阵中对应元素的权重值的连接类型;至少部分连接类型的数据量小于对应的权重值的数据量,且连接类型分为有效连接和无效连接。
数据类型表包括依次设置的、权重矩阵中有效连接的权重值对应的数据类型;至少部分数据类型的数据量小于对应的权重值的数据量,且数据类型包括特殊值型和多个第一预设值型,第一预设值型对应第一预设权重值,第一预设权重值为有效连接的预设权重值,特殊值型对应特殊权重值,除第一预设权重值外的其它有效连接的权重值属于特殊权重值。
换言之,可以根据权重矩阵中各个权重值的连接情况以及权重值的数据类型,将权重矩阵转换为相应的连接矩阵、数据类型表和特殊值表,即编码阵列的编码包括两类,一类编码是基于权重值的连接情况生成的编码,对应连接矩阵,另一类是根据权重值的数据类型生成的编码,对应数据类型表和特殊值表。相应的,连接矩阵用于表征该权重矩阵中各个权重值是否处于有效连接(或无效连接),数据类型表对应处于有效连接的权重值的数据类型,特殊值表包括若干特殊的权重值。在进行存储操作时,直接存储连接矩阵、数据类型表和特殊值表即可。
在一些可能的实现方式中,编码阵列还可以包括类型矩阵,类型矩阵与权重矩阵结构相同,且类型矩阵的元素为权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;类型包括特殊值型和多个第二预设值型;第二预设值型对应第二预设权重值,特殊值型对应特殊权重值,除第二预设权重值外的其它权重值属于特殊权重值。
换言之,还可以根据权重矩阵中权重值的类型(包括有效连接/无效连接类型和数据类型),将权重矩阵转换为相应的类型矩阵和特殊值表,即编码阵列中编码只有一类,且该编码是根据权重值的有效连接/无效连接类型以及数据类型共同确定并生成的编码。相应的,类型矩阵不仅可以表征权重值是否处于有效连接/无效连接,还可以表征有效连接的权重值的数据类型。在进行存储操作时,直接存储类型矩阵和特殊值表即可。
需要说明的是,以上对于编码阵列仅是举例说明,还可以根据其他方式设置编码阵列,本公开实施例对此不作限定。
在本公开实施例中,对于在权重矩阵中多次重复出现的权重值,通过设置编码阵列以及特殊值表的方式,使得这些权重值被数据量更小的编码表示和存储,从而可以有效减少对存储空间的占用。相应的,在需要使用权重矩阵的情况下,可以根据编码阵列、 特殊值表,以及预存的预设权重值,准确地恢复权重矩阵。
下面结合图2-4对本申请实施例的权重矩阵的数据存储方法进行展开说明。
图2为本公开实施例提供的一种权重矩阵的数据存储方法的流程图。参照图2,本公开实施例的数据存储方法包括:
S101、根据权重矩阵,生成连接矩阵、数据类型表、特殊值表。
S102、存储连接矩阵、数据类型表、特殊值表。
其中,连接矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值的连接类型;一个连接类型的数据量小于一个权重值的数据量,连接类型分为有效连接和无效连接;
数据类型表包括依次设置的、权重矩阵中有效连接的权重值对应的数据类型;一个数据类型的数据量小于一个权重值的数据量,数据类型包括特殊值型和多个预设值型,每个预设值型对应一个有效连接的预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它有效连接的权重值均为特殊权重值;
特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
本公开实施例中,根据所要存储的权重矩阵的内容(数据),产生对应的连接矩阵、数据类型表、特殊值表,并将连接矩阵、数据类型表、特殊值表存储下来,以体现权重矩阵的信息(数据),供后续的类脑计算过程使用。
其中,参照图3,连接矩阵与权重矩阵的形式、尺寸均相同,故连接矩阵的每个元素,必然对应权重矩阵中一个处于相同的相对位置的元素。而且,连接矩阵的每个元素的值,为其在权重矩阵中对应的元素的权重值所属的“连接类型”。
在权重矩阵中,有一部分权重值是在后续的类脑计算过程中“有用”或“有效”的,其称为“有权重”或“有效权重值”,这类权重值的连接类型为“有效连接”;同时,权重矩阵中,另有一部分权重值在后续的类脑计算过程中实际“无用”或“无效”,其称为“无权重”或“无效权重值”,例如其权重值为0,这类权重值的连接类型为“无效连接”。
可见,以上无效连接的权重值实际相当于权重矩阵中的0元素,而有效连接的权重值实际相当于权重矩阵中的非0元素。
由于以上无效连接的权重值不起实际作用,故没有必要将其“具体值”存储下来,而是通过以上连接矩阵标明权重矩阵中哪些元素是0元素(无效连接的权重值),哪些是非0元素(有效连接的权重值)即可。
例如,可参照图3,连接矩阵中用1表示有效连接(非0元素),用0表示无效连接(0元素)。
进一步的,权重矩阵的有效连接的每个权重值具有一定的“数据类型”。示例性的,权重矩阵的有效连接的权重值中有很多是多次重复出现的,如一些兴奋权重值、抑制权重值、空权重等,故可将每个多次出现的权重值(有效连接的权重值)定义为一个预设权重值,使其属于一个“预设值型”;而权重矩阵中其它的权重值(有效连接的权重值) 出现较少,故将它们全部定义为特殊权重值,并属于“特殊值型”。
由此,可将权重矩阵的有效连接的各权重值对应的数据类型按照预定的顺序(如逐行排列的顺序)存储下来,作为“数据类型表”。由此,数据类型表实际是一系列有顺序的数据(数据类型),也可视为“一维矩阵”或“序列”。
例如,参照图3和下表1、表2,权重矩阵中的预设权重值可包括权重值A、权重值B、权重值C,从而数据类型表中的每个数据类型的数据量可为2bits,如分别用01、10、00对应权重值A、权重值B、权重值C这三种预设权重值(预设值型),而用11对应特殊权重值(特殊值型)。
表1、数据类型与权重值的对应关系
数据类型 01(预设值型) 10(预设值型) 00(预设值型) 11(特殊值型)
权重值 权重值A 权重值B 权重值C 特殊权重值
表2、数据类型表
11 01 00 01 10 11 00 11
以上权重矩阵的所有特殊权重值(也就是对应数据类型表中所有特殊值型的权重值),也可依次(与数据类型表的顺序相同)存储下来,作为特殊值表。由此,特殊值表实际是一系列有顺序的数据(特殊权重值),也可视为“一维矩阵”或“序列”。
参照图3和下表3,特殊值表的形式可为:
表3、特殊值表
3.2364 -0.1231 63.7089
基于矩阵的格式要求,其中所有元素的数据精度是一样的。由此,例如每个权重值的数据量为16bits,则有N个元素的权重矩阵占据的存储空间为16*Nbits。
如前,连接矩阵的每个元素可仅为1或0,占据1bit的存储空间,故以上权重矩阵对应的连接矩阵占据的存储空间为Nbits。
假设权重矩阵中有80%的权重属于无效权重值,只有20%的权重属于有效权重值时,则如前,数据类型表占据的存储空间为20%*2*Nbits。
假设权重矩阵中有5%的权重属于特殊权重值,则特殊值表占据的存储空间为5%*16*Nbits。
由此,以上连接矩阵、数据类型表、特殊值表占据的总存储空间为N+20%*2*N+5%*16N=2.2Nbits,即使加上各预设权重值占据的存储空间也只是再增加3*16=48bits,在N很大时,该存储空间远远小于16*Nbits,故本公开实施例的方式可大大节约存储空间。
显然,权重矩阵中无效连接的权重值(无效权重值)的比例越大,以及权重矩阵中有效连接的权重值中预设权重值的占比越大,则本公开实施例的方式节约存储空间的效果越好。因此,本公开实施例特别适用于无效权重值占比较大的稀疏矩阵。
例如,本公开实施例可用于无效连接的权重值(无效权重值)至少占(在所有权重值中的个数比)40%,或至少占60%,或至少占80%的权重矩阵。
再如,本公开实施例可用于预设权重值至少占(在有效连接的权重值中的个数比)40%,或至少占60%,或至少占80%的权重矩阵。
本公开实施例中,实际存储的只有连接矩阵、数据类型表、特殊值表、预设权重值,其中,连接矩阵只有权重值的“连接类型”,数据类型表只有有效连接的权重值的“数据类型”,而每个连接类型、数据类型的数据量显然远小于权重值的数据量,故连接矩阵、数据类型表占用的存储空间远小于权重矩阵占用的存储空间;而特殊值表和预设权重值只是权重矩阵中很少的权重值,故它们占用的存储空间也很小。
由此,本公开实施例中,所有实际存储的数据占用的存储空间比权重矩阵占用的存储空间小的多,但实际上包括了权重矩阵的全部信息(数据),从而大大节约了存储空间。
在一些实施例中,每个连接类型的数据量为一位。
如前,由于连接类型只有两种,故每个连接类型的数据量为一位(1bit),如为以上1或0。
参照图4,在一些实施例中,在根据权重矩阵确定其中的多个有效连接的权重值为预设权重值,并存储预设权重值(S101),还包括:
S100、根据权重矩阵确定其中的多个权重值为预设权重值,并存储预设权重值。
如前,预设权重值的选取对节约存储空间的效果有明显影响,预设权重值过少则特殊权重值过多,特殊值表占用的存储空间过大;而预设权重值的种类过多,则会导致每个“数据类型”的数据量过大,进而导致数据类型表占用的存储空间过大。
为此,可根据当前要存储的权重矩阵的状况,选择其中部分多次出现的权重值为预设权重值,并将选定的预设权重值存储下来,以起到更好的节约存储空间的效果。
当然,也可以是根据大量权重矩阵的总体情况,预先设定通用的预设权重值并存储,而不是根据每个权重矩阵设置预设权重值。如前所述,在一些可能的实现方式中,编码阵列还可以包括类型矩阵。下面结合图5-7对本申请实施例的权重矩阵的数据存储方法进行展开说明。图5为本公开实施例提供的一种权重矩阵的数据存储方法的流程图。参照图5,本公开实施例的数据存储方法包括:
S201、根据权重矩阵生成类型矩阵和特殊值表。
S202、存储类型矩阵和特殊值表。
其中,类型矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值对应的类型,一个类型的数据量小于一个权重值的数据量;类型包括特殊值型和多个预设值型;每个预设值型对应一个预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它权重值均为特殊权重值;特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
本公开实施例中,根据所要存储的权重矩阵的内容(数据),产生对应的类型矩阵和特殊值表,并将类型矩阵和特殊值表存储下来,以体现权重矩阵的信息(数据),供后续的类脑计算过程使用。
其中,参照图6,类型矩阵与权重矩阵的形式、尺寸均相同,故类型矩阵的每个元素,必然对应权重矩阵中一个处于相同的相对位置的元素。而且,类型矩阵的每个元素的值,为其在权重矩阵中对应的元素的权重值所属的“类型”。
显然,在权重矩阵中,有很多权重值是多次重复出现的,如一些兴奋权重值、抑制权重值、空权重等,故可将每个多次出现的权重值定义为一个预设权重值,使其属于一个“预设值型”;而权重矩阵中其它的权重值出现较少,故将它们全部定义为特殊权重值,并属于“特殊值型”。
而在特殊值表中,则将权重矩阵中出现的所有特殊权重值,按照预定的顺序(如逐行排列的顺序)存储下来。由此,特殊值表实际是一系列有顺序的数据(特殊权重值),也可视为“一维矩阵”或“序列”。
例如,参照图6,特殊值表的形式可参见表3所示的特殊值表。
并且,基于矩阵的格式要求,其中所有元素的数据精度是一样的。由此,例如每个权重值的数据量为16bits,则有N个元素的权重矩阵占据的存储空间为16*Nbits。
如前,权重值可能的类型通常是很少的几种,故“类型”的数据量显然远远小于权重值的数据量,例如,参照图6和下表4,权重矩阵中的预设权重值可包括权重值A、权重值B,以及空权重(用0表示),从而类型矩阵中的每个类型的数据量可为2bits,如分别用01、10、00对应权重值A、权重值B、空权重这三种预设权重值,而用11对应特殊权重值。
表4、类型与权重值的对应关系表
类型 01 10 00 11
权重值 权重值A 权重值B 0 特殊权重值
由此,类型矩阵占据的存储空间为2*Nbits。
例如,当权重矩阵中有80%的元素都属于预设权重值时,则只有20%的元素为特殊权重值,故特殊值表占用的存储空间为20%*16*Nbits。
由此,按照以上方式存储的权重矩阵的数据(类型矩阵和特殊值表)总计占用的存储空间为2*N+20%*16*N=5.2*Nbits,即使加上各预设权重值占用的存储空间也只是再增加3*16=48bits,在N很大时,该存储空间远远小于16*Nbits,故本公开实施例的方式可大大节约存储空间。
显然,权重矩阵中预设权重值的占比(数量比)越大,则本公开实施例的方式节约存储空间的效果越好,故本公开实施例特别适用于预设权重值占较大的权重矩阵,例如用于空权重占比较大的稀疏矩阵(空权重为预设权重值的一种)。
例如,本公开实施例可用于预设权重值至少占(在所有权重值中的个数比)40%,或至少占60%,或至少占80%的权重矩阵。
本公开实施例中,实际存储的只有类型矩阵、特殊值表、预设权重值,其中,类型矩阵只有权重值的“类型”,而每个类型的数据量显然远小于权重值的数据量,故类型矩阵占用的存储空间远小于权重矩阵占用的存储空间;而特殊值表和预设权重值只是权 重矩阵中很少的权重值,故它们占用的存储空间也很小。
由此,本公开实施例中,所有实际存储的数据占用的存储空间比权重矩阵占用的存储空间小的多,但实际上包括了权重矩阵的全部信息(数据),从而大大节约了存储空间。
在一些实施例中,预设权重值包括:空权重;以及,至少一个预设的、非空的权重值。
很多权重矩阵都是稀疏矩阵,即其中空权重的占比较大(如至少占40%,或至少占60%,或至少占80%),故可将空权重作为一种预设权重值,同时还有一些其它的非空的权重值作为权重值。
参照图7,在一些实施例中,在根据权重矩阵生成类型矩阵和特殊值表(S201)之前,还包括:
S200、根据权重矩阵确定其中的多个权重值为预设权重值,并存储预设权重值。
如前,预设权重值的选取对节约存储空间的效果有明显影响,预设权重值过少则特殊权重值过多,特殊值表占用的存储空间过大;而预设权重值的种类过多,则会导致每个“类型”的数据量过大,进而导致类型矩阵占用的存储空间过大。
为此,可根据当前要存储的权重矩阵的状况,选择其中部分多次出现的权重值为预设权重值,并将选定的预设权重值存储下来,以起到更好的节约存储空间的效果。
当然,也可以是根据大量权重矩阵的总体情况,预先设定通用的预设权重值并存储,而不是根据每个权重矩阵设置预设权重值。
第二方面,本公开实施例提供一种权重矩阵的数据获取方法,其用根据以上方法存储得到的权重矩阵的数据,获取权重矩阵中所需的权重值,用于后续的类脑计算过程。
图8为本公开实施例提供的一种权重矩阵的数据获取方法的流程图。参照图8,本公开实施例的数据获取方法包括:
步骤S31,根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值。
步骤S32,获取确定的权重值。
其中,编码阵列和所述特殊值表所占的存储空间小于所述权重矩阵所占的存储空间;特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
在一些可能的实现方式中,编码阵列的数量为一个或多个,编码阵列中的元素为权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;特殊值表包括依次设置的、权重矩阵中的多个特殊权重值,特殊权重值包括权重矩阵中除预设权重值之外的权重值,预设权重值为预先预设的权重值。
在一些可能的实现方式中,编码阵列包括连接矩阵和数据类型表;
根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值,包括:
根据预存的连接矩阵、数据类型表和特殊值表,确定权重矩阵对应元素的权重值;
其中,连接矩阵与权重矩阵结构相同,且连接矩阵的元素为权重矩阵中对应元素的权重值的连接类型;至少部分连接类型的数据量小于对应的权重值的数据量,且连接类 型分为有效连接和无效连接;
数据类型表包括依次设置的、权重矩阵中有效连接的权重值对应的数据类型;至少部分数据类型的数据量小于对应的权重值的数据量,且数据类型包括特殊值型和多个第一预设值型,第一预设值型对应第一预设权重值,第一预设权重值为有效连接的预设权重值,特殊值型对应特殊权重值,除第一预设权重值外的其它有效连接的权重值属于特殊权重值。
在一些可能的实现方式中,编码阵列还可以包括类型矩阵;
根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值,包括:
根据预存的类型矩阵的元素的类型,以及预存的特殊值表、第二预设权重值,确定权重矩阵中对应元素的权重值;
其中,类型矩阵与权重矩阵结构相同,且类型矩阵的元素为权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;类型包括特殊值型和多个第二预设值型;第二预设值型对应第二预设权重值,特殊值型对应特殊权重值,除第二预设权重值外的其它权重值属于特殊权重值。
需要说明的是,以上对于编码阵列仅是举例说明,还可以根据其他方式设置编码阵列,本公开实施例对此不作限定。
下面结合图9-13对本申请实施例的权重矩阵的数据获取方法进行展开说明。
图9为本公开实施例提供的一种权重矩阵的数据获取方法的流程图。参照图9,本公开实施例的权重矩阵的数据获取方法包括:
S401、根据预存的连接矩阵、数据类型表和特殊值表,确定权重矩阵中对应元素的权重值。
其中,连接矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值的连接类型;一个连接类型的数据量小于一个权重值的数据量,连接类型分为有效连接和无效连接;
数据类型表包括依次设置的、权重矩阵中有效连接的权重值对应的数据类型;一个数据类型的数据量小于一个权重值的数据量,数据类型包括特殊值型和多个预设值型,每个预设值型对应一个有效连接的预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它有效连接的权重值均为特殊权重值;
特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
可见,通过以上方式存储的权重矩阵的数据并不是“权重矩阵”本身,故当需要使用权重矩阵中某个元素的权重值时,需要先根据连接矩阵中的相应元素(处于相同相对位置的元素)确定该权重值是有效连接还是无效连接,在权重值为有效连接时,继续根据数据类型表确定该权重值的数据类型,进而确定该权重值为哪个预设权重值或特殊值表中的哪个特殊权重值,即得到其权重值。
作为本公开实施例的一种形式,可以是在需要使用权重矩阵中元素的权重值时,直接按照以上方式得到相应的权重值,并直接读出、利用。
参照图11,在一些实施例中,在根据预存的连接矩阵、数据类型表、特殊值表,确定权重矩阵中对应元素的权重值(S401)之后,还包括:
S402、根据所确定的权重值,复原权重矩阵的至少部分区域,并将复原的权重矩阵的区域存储至临时存储空间;
S403、从临时存储空间获取权重矩阵的权重值。
作为本公开实施例的另一种形式,也可以是先得到权重矩阵中部分或全部的权重值,也就是“复原”权重矩阵或其一部分,并将复原的权重矩阵或其一部分存储在临时存储空间中,故临时存储空间中相当于有一个“临时权重矩阵”,从而在需要时,可从该“临时权重矩阵”中获取权重值。
其中,当使用完“临时权重矩阵”中的数据后,可重新向临时存储空间中写入权重矩阵的“另一部分”。
下面对得到权重矩阵中元素的权重值的实现方式进行介绍。
应当理解,如何得到权重矩阵中元素的权重值,与权重值后续被如何利用没有必然关系。例如,通过以下方式得到的权重值,可以被直接获取,也可以用于形成以上“临时权重矩阵(如S402、S403)”。
应当理解,以下得到权重矩阵中元素的实现方式只是示例性的,而不是对本公开范围的限定。
参照图12,在一些实施例中,根据预存的连接矩阵、数据类型表、特殊值表,确定权重矩阵中对应元素的权重值(S401)包括:
A1、地址产生器依次产生连接矩阵中各元素的地址,并输入至连接矩阵存储器。
A2、连接矩阵存储器根据接收到的地址,将其中预存的连接矩阵的相应元素的连接类型输入至第一选通器和数据类型存储器。
A3、数据类型存储器在接收到有效连接时,将其中预存的数据类型表的相应数据类型输入至第二选通器和特殊值判断器。
A4、预设值存储器将其中预存的各预设权重值同步输入至第二选通器。
A5、特殊值判断器在接收到的数据类型为特殊值型时,向特殊值存储器输出更新信号。
A6、特殊值存储器将其中预存的特殊值表的当前特殊权重值输入至第二选通器,并在接收到更新信号时将当前特殊权重值更新为特殊值表的下一个特殊权重值。
A7、第二选通器根据接收到的数据类型,从接收到的当前特殊权重值、各预设权重值中选择一个输出。
A8、无效值存储器将其中预存的无效权重值输入至第一选通器。
A9、第一选通器根据接收到的连接类型,从接收到的无效权重值、第二选通器的输出中选择一个输出。
应当理解,以上每个步骤描述的只是相应结构进行的工作或功能,故以上步骤的描述顺序,并不代表其必然的执行顺序。
参照图12,地址产生器依次(与数据类型表、特殊值表的存储顺序对应)产生地址并将其输入至连接矩阵存储器。
其中,以上产生的地址用于表明当前需要确定权重矩阵中哪个元素的权重值;故为了简便,权重矩阵和连接矩阵中对应元素的地址可以是相同的。
连接矩阵存储器根据接收到的地址,将地址所指元素的连接类型(如以上1或0)输入第一选通器和数据类型存储器。
数据类型存储器在接收到的连接类型为“有效连接(如1)”时,将其中存储的数据类型表的相应数据类型,即对应该有效连接的地址的权重值的数据类型(如以上01、10、00、11)输入到第二选通器。
其中,数据类型存储器可通过多种方式实现输出“相应的”数据类型,例如,数据类型存储器可在每次接收到“有效连接”是“更新”输出数据类型表的“下一个”数据类型,从而保证其输出的数据类型的序数,等于相应权重值在权重矩阵的全部有效连接的权重值中的序数。
其中,如果数据类型存储器接收到的连接类型为“无效连接(如0)”,则其可继续输出之前的数据类型,也可以不输出,在此不再详细描述。
同时,预设值存储器(如寄存器)将其中存储的所有预设权重值(如以上权重值A、权重值B、权重值C)同步的输入(如持续输入)至第二选通器;特殊值存储器也将其中存储的当前特殊权重值输入(如持续输入)至第二选通器。
由此,第二选通器同时接收到所有的预设权重值以及当前特殊权重值。
同时,第二选通器还接收到当前需要确定权重值的元素的数据类型(来自数据类型存储器),从而其可根据该数据类型,确定应让哪一个权重值输出(例如,数据类型为01则输出权重值A,数据类型为10则输出权重值B,数据类型为00则输出权重值C,数据类型为11则输出当前特殊权重值),即确定将哪一“路”的输入选通;而第二选通器接收到的其它各“路”权重值并不是对应当前元素的,故不被输出。
其中,若第二选通器未接收到数据类型,也可不产生任何输出。
其中,数据类型存储器还将数据类型输入至特殊值判断器,特殊值判断器则在接收到的数据类型为特殊值型(如为11)时,向特殊值存储器输出更新信号,以供特殊值存储器“更新”当前特殊权重值,即选择特殊值表中的“下一个”特殊权重值作为新的当前特殊权重值,并输出至选通器。
可见,地址产生器产生的地址是“依次”的,数据类型表中的各数据类型也是按照相同方式“依次”的,特殊值存储中的特殊值表中的各特殊权重值也是按照相同方式“依次”排列的,由此,通过在数据类型为特殊值型时更新当前特殊权重值,可保证地址与当前特殊权重值是“同步”的。
进一步的,无效值存储器还将其中预存的无效权重值(无权重,例如权重值为0)也输入(如持续输入)到第一选通器,即第一选通器同时接收到无效权重值和第二选通器的输出(预设权重值或当前特殊权重值)。
由此,第一选通器可根据接收到的连接类型(来自连接矩阵存储器),从接收到的无效权重值、第二选通器的输出中选择一个输出,示例性的,在接收到无效连接时输出无效权重值,而在接收到有效连接时输出第二选通器的输出(预设权重值或当前特殊权重值,均属于有效权重值),从而实现对无效权重值的准确输出。
参照图13,在一些实施例中,权重矩阵的数据获取的装置包括获取单元,每个获取单元包括以上的连接矩阵存储器、数据类型存储器、特殊值判断器、第一选通器、第二选通器。
当获取单元的数量为多个时,每个获取单元还包括:输出使能器,其连接第一选通器的输出;
本公开实施例的装置还包括:逻辑控制器,其连接在各特殊值判断器与特殊值存储器之间,且连接各输出使能器;逻辑控制器被配置为将更新信号发送至特殊值存储器,且在同时接收到多个更新信号时,将多个更新信号依次输入至特殊值存储器,并控制对应各更新信号的各获取单元的输出使能器依次导通。
如前,每个获取单元可确定一个元素的权重值,故若要以“并行”方式同时确定多个元素的权重值(如权重矩阵的一行中多个相邻元素的权重值)时,则需要同时使用多个(图13以两个为例)获取单元,各获取单元同步工作,每个获取单元确定一个权重值。
其中,当有多个获取单元时,若涉及到两个属于获取单元的结构的交互,则若无特殊说明,应当是指同一个获取单元内部的两个结构进行交互。
参照图13,当有多个获取单元时,其中的特殊值存储器、预设值存储器、无效值存储器可以“公用”,即它们将当前特殊权重值、预设权重值同步输出到所有获取单元的第二选通器,而将无效权重值输出到所有获取单元的第一选通器,从而简化硬件结构。
而地址产生器也是“公用”的,区别在于其将各获取单元应处理的元素的地址分别输入至相应获取单元的连接矩阵存储器(即其同一时刻输入到各连接矩阵存储器的地址不同,但按顺序排列),再由各获取单元的连接矩阵存储器将对应的连接类型输入至自身所在获取单元的第一选通器和数据类型存储器,以供第一选通器输出相应元素的权重值。
其中,当“并行”输出的多个元素的权重值中有多个特殊权重值时,则必然有多个获取单元的第二选通器接收到的数据类型为特殊值型,并分别输出该当前特殊权重值到第一选通器;但是,该多个不同获取单元应输出(通过第一选通器输出)的特殊权重值实际是不同的,即特殊值存储器需要对当前特殊权重值进行多次更新,
为此,参照图13,还需要设置逻辑控制器和输出使能器。
其中,若逻辑控制器同时只接收到一个更新信号,则直接将其转发至特殊值存储器即可。
而当“并行”输出的多个元素的权重值中有多个特殊权重值时,逻辑控制器必然同时接收到多个更新信号(如两个更新信号),从而其需要依次将更新信号输入至特殊值 存储器(如先将第一个更新信号输入至特殊值存储器,一定时间后再将第二个更新信号输入至特殊值存储器)。进而,特殊值存储器会多次更新当前特殊权重值,并在不同时间分别输出不同的当前特殊权重值(如在收到第一个更新信号后而收到第二个更新信号前,输出第一个当前特殊权重值;而在收到第二个更新信号后输出第二个当前特殊权重值)。
相应的,在同时接收到多个更新信号时,逻辑控制器还需要以轮询的方式,控制对应各更新信号的获取单元的输出使能器依次导通(如在特殊值存储器输出第一个当前特殊权重值时,使对应第一个更新信号的获取单元的输出使能器导通,使对应第二个更新信号的获取单元的输出使能器关断;而在特殊值存储器输出第二个当前特殊权重值时,使对应第二个更新信号的获取单元的输出使能器导通,使对应第一个更新信号的获取单元的输出使能器关断)。
由此,对应各更新信号的多个获取单元,可分别输出(是“并行”输出,但不是完全“同时”)各自对应的元素的特殊权重值。
其中,同时接收到多个更新信号时,逻辑控制器应控制其它不对应更新信号的获取单元的输出使能器保持导通状态;而在同时只接收到一个更新信号或未接收到更新信号时,逻辑控制器应控制所有获取单元的输出使能器保持导通状态,在此不再详细描述
其中,逻辑控制器的实现方式是多样的,例如,逻辑控制器可通过乘加器实现节拍性的调整工作状态,在此不再详细描述。
如前所示,在一些可能的实现方式中,编码阵列还可以包括类型矩阵。
下面结合图14-18对本申请实施例的权重矩阵的数据获取方法进行展开说明。
图14为本公开实施例提供的一种权重矩阵的数据获取方法的流程图。参照图14,本公开实施例的权重矩阵的数据获取的方法包括:
S501、根据预存的类型矩阵的元素的类型,以及预存的特殊值表、预设权重值,确定权重矩阵中对应元素的权重值。
其中,类型矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值对应的类型,一个类型的数据量小于一个权重值的数据量;类型包括特殊值型和多个预设值型;每个预设值型对应一个预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它权重值均为特殊权重值;特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
可见,通过以上方式存储的权重矩阵的数据并不是“权重矩阵”本身,故当需要使用权重矩阵中某个元素的权重值时,需要根据类型矩阵中相应元素(处于相同相对位置的元素)的类型,确定其对应的是哪种权重值,再根据特殊值表和预设权重值,确定其对应的特殊权重值或预设权重值。
参照图15,在一些实施例中,在根据预存的类型矩阵的元素的类型,以及预存的特殊值表、预设权重值,确定权重矩阵中对应元素的权重值(S501)之后,还包括:
S502、获取所确定的权重值。
作为本公开实施例的一种形式,可以是在需要使用权重矩阵中元素的权重值时,直接按照以上方式得到相应的权重值,并直接读出、利用。
参照图16,在一些实施例中,在根据预存的类型矩阵的元素的类型,以及预存的特殊值表、预设权重值,确定权重矩阵中对应元素的权重值(S501)之后,还包括:
S503、根据所确定的权重值,复原权重矩阵的至少部分区域,并将复原的权重矩阵的区域存储至临时存储空间;
S504、从临时存储空间获取权重矩阵的权重值。
作为本公开实施例的另一种形式,也可以是先得到权重矩阵中部分或全部的权重值,也就是“复原”权重矩阵或其一部分,并将复原的权重矩阵或其一部分存储在临时存储空间中,故临时存储空间中相当于有一个“临时权重矩阵”,从而在需要时,可从该“临时权重矩阵”中获取权重值。
其中,当使用完“临时权重矩阵”中的数据后,可重新向临时存储空间中写入权重矩阵的“另一部分”。
下面对得到权重矩阵中元素的权重值的实现方式进行介绍。
应当理解,如何得到权重矩阵中元素的权重值,与权重值后续被如何利用没有必然关系。例如,通过以下方式得到的权重值,可以被直接获取(如S502),也可以用于形成以上“临时权重矩阵(如S503、S504)”。
应当理解,以下得到权重矩阵中元素的实现方式只是示例性的,而不是对本公开范围的限定。
参照图17,在一些实施例中,根据预存的类型矩阵的元素的类型,以及预存的特殊值表、预设权重值,确定权重矩阵中对应元素的权重值(S501)包括:
B1、地址产生器依次产生类型矩阵中各元素的地址,并输入至类型矩阵存储器。
B2、预设值存储器将其中预存的各预设权重值同步输入至第三选通器。
B3、类型矩阵存储器根据接收到的地址,将其中预存的类型矩阵的相应元素的类型输入至第三选通器和特殊值判断器。
B4、特殊值判断器在接收到的类型为特殊值型时,向特殊值存储器输出更新信号。
B5、特殊值存储器将其中预存的特殊值表的当前特殊权重值输入至第三选通器,并在接收到更新信号时将当前特殊权重值更新为特殊值表的下一个特殊权重值。
B6、第三选通器根据接收到的类型,从接收到的当前特殊权重值、各预设权重值中选择一个输出。
应当理解,以上每个步骤描述的只是相应结构进行的工作或功能,故以上步骤的描述顺序,并不代表其必然的执行顺序。
参照图17,地址产生器依次(与特殊值表中特殊权重值的存储顺序对应)产生地址并将其输入至类型矩阵存储器。
其中,以上产生的地址用于表明当前需要确定权重矩阵中哪个元素的权重值;故为了简便,权重矩阵和类型矩阵中对应元素的地址可以是相同的。
类型矩阵存储器根据接收到的地址,将地址所指元素的类型(如以上01、10、00、11)输入至第三选通器。
同时,预设值存储器(如寄存器)则将其中存储的所有预设权重值(如以上权重值A、权重值B、0)同步的输入(如持续输入)至第三选通器;特殊值存储器也将其中存储的当前特殊权重值输入(如持续输入)至第三选通器。
由此,第三选通器同时接收到所有的预设权重值以及当前特殊权重值;同时,第三选通器还接收到当前需要确定权重值的元素的类型,从而其可根据该类型,确定应让哪一个权重值输出(例如,类型为01则输出权重值A,类型为10则输出权重值B,类型为00则输出0,类型为11则输出当前特殊权重值),即确定将哪一“路”的输入选通,作为当前元素的权重值输出;而第三选通器接收到的其它各“路”权重值并不是对应当前元素的,故不被输出。
其中,类型矩阵存储器还将类型输入至特殊值判断器,特殊值判断器则在接收到的类型为特殊值型(如为11)时,向特殊值存储器输出更新信号,以供特殊值存储器“更新”当前特殊权重值,即选择特殊值表中的“下一个”特殊权重值作为新的当前特殊权重值,并输出至第三选通器。
可见,地址产生器产生的地址是“依次”的,而特殊值存储器中的特殊值表中的各特殊权重值也是按照相同方式“依次”排列的,从而,通过在类型为特殊值型时更新当前特殊权重值,可保证地址与当前特殊权重值是“同步”的,即保证输出的特殊权重值,必然是当前元素实际对应的那个特殊权重值。
参照图18,在一些实施例中,权重矩阵的数据获取的装置包括获取单元,每个获取单元包括以上的类型矩阵存储器、特殊值判断器、第三选通器。
当获取单元的数量为多个时,每个获取单元还包括:输出使能器,其连接第三选通器的输出;
而权重矩阵的数据获取的装置还包括:逻辑控制器,其连接在各特殊值判断器与特殊值存储器之间,且连接各输出使能器;逻辑控制器被配置为将更新信号发送至特殊值存储器,且在同时接收到多个更新信号时,将多个更新信号依次输入至特殊值存储器,并控制对应各更新信号的各获取单元的输出使能器依次导通。
如前,每个获取单元可确定一个元素的权重值,故若要以“并行”方式同时确定多个元素的权重值(如权重矩阵的一行中多个相邻元素的权重值)时,则需要同时使用多个(图18以两个为例)获取单元,各获取单元同步工作,每个获取单元确定一个权重值。
其中,当有多个获取单元时,若涉及到两个属于获取单元的结构的交互,则若无特殊说明,应当是指同一个获取单元内部的两个结构进行交互。
参照图18,当有多个获取单元时,其中特殊值存储器和预设值存储器可以“公用”,即它们将当前特殊权重值、预设权重值同步输出到所有获取单元的第三选通器,从而简化硬件结构。
而地址产生器也是“公用”的,区别在于其将各获取单元应处理的元素的地址分别输入至相应获取单元的类型矩阵存储器(即其同一时刻输入到各类型矩阵存储器的地址不同,但按顺序排列),再由各获取单元的类型矩阵存储器将对应的类型输入至自身所在获取单元的第三选通器,以供第三选通器输出相应元素的权重值。
其中,当“并行”输出的多个元素的权重值中有多个特殊权重值时,则必然有多个获取单元的第三选通器接收到的类型为特殊值型,并分别输出当前特殊权重值;但是,该多个不同获取单元应输出的特殊权重值实际是不同的,即特殊值存储器需要对当前特殊权重值进行多次更新,
为此,参照图18,还需要设置逻辑控制器和输出使能器。
其中,若逻辑控制器同时只接收到一个更新信号,则直接将其转发至特殊值存储器即可。
而当“并行”输出的多个元素的权重值中有多个特殊权重值时,逻辑控制器必然同时接收到多个更新信号(如两个更新信号),从而其需要依次将更新信号输入至特殊值存储器(如先将第一个更新信号输入至特殊值存储器,一定时间后再将第二个更新信号输入至特殊值存储器)。进而,特殊值存储器会多次更新当前特殊权重值,并在不同时间分别输出不同的当前特殊权重值(如在收到第一个更新信号后而收到第二个更新信号前,输出第一个当前特殊权重值;而在收到第二个更新信号后输出第二个当前特殊权重值)。
相应的,在同时接收到多个更新信号时,逻辑控制器还需要以轮询的方式,控制对应各更新信号的获取单元的输出使能器依次导通(如在特殊值存储器输出第一个当前特殊权重值时,使对应第一个更新信号的获取单元的输出使能器导通,使对应第二个更新信号的获取单元的输出使能器关断;而在特殊值存储器输出第二个当前特殊权重值时,使对应第二个更新信号的获取单元的输出使能器导通,使对应第一个更新信号的获取单元的输出使能器关断)。
由此,对应各更新信号的多个获取单元,可分别输出(是“并行”输出,但不是完全“同时”)各自对应的元素的特殊权重值。
其中,同时接收到多个更新信号时,逻辑控制器应控制其它不对应更新信号的获取单元的输出使能器保持导通状态;而在同时只接收到一个更新信号或未接收到更新信号时,逻辑控制器应控制所有获取单元的输出使能器保持导通状态,在此不再详细描述
其中,逻辑控制器的实现方式是多样的,例如,逻辑控制器可通过乘加器实现节拍性的调整工作状态,在此不再详细描述。
第三方面,本公开实施例提供一种权重矩阵的数据获取装置。
图19为本公开实施例提供的一种权重矩阵的数据获取装置的框图。参照图19,本公开实施例的数据获取装置包括:处理单元1901以及至少一个获取单元1902;
处理单元1901,被配置为根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值;
获取单元1902,被配置为获取确定的权重值;
其中,编码阵列和特殊值表所占的存储空间小于权重矩阵所占的存储空间;特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
示例性地,参照图12,其为本公开实施例提供一种权重矩阵的数据获取的装置,其包括地址产生器、特殊值存储器、无效值存储器、预设值存储器,以及至少一个获取单元;其中,
地址产生器被配置为依次产生连接矩阵中各元素的地址,并输入至相应获取单元的连接矩阵存储器;
预设值存储器被配置为存储所有预设权重值,并将各预设权重值同步输入至所有获取单元的第二选通器;
无效值存储器被配置为存储无效权重值,并输入至所有获取单元的第一选通器;
特殊值存储器被配置为存储特殊值表,将特殊值表的当前特殊权重值输入至第二选通器,并在接收到更新信号时将当前特殊权重值更新为特殊值表的下一个特殊权重值;
每个获取单元包括:
连接矩阵存储器,被配置为存储连接矩阵,并根据接收到的地址,将连接矩阵的相应元素的连接类型输入至第一选通器和数据类型存储器;
数据类型存储器,被配置为在接收到有效连接时,将其中预存的数据类型表的相应数据类型输入至第二选通器和特殊值判断器;
特殊值判断器,被配置为在接收到的数据类型为特殊值型时,向特殊值存储器输出更新信号;
第二选通器,被配置为根据接收到的数据类型,从接收到的当前特殊权重值、各预设权重值中选择一个输出;
第一选通器,被配置为根据接收到的连接类型,从接收到的无效权重值、第二选通器的输出中选择一个输出;
其中,连接矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值的连接类型;一个连接类型的数据量小于一个权重值的数据量,连接类型分为有效连接和无效连接;
数据类型表包括依次设置的、权重矩阵中有效连接的权重值对应的数据类型;一个数据类型的数据量小于一个权重值的数据量,数据类型包括特殊值型和多个预设值型,每个预设值型对应一个有效连接的预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它有效连接的权重值均为特殊权重值;
特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
示例性地,参照图13,在一些实施例中,获取单元的数量为多个;
每个获取单元还包括:输出使能器,其连接第一选通器的输出;
装置还包括:逻辑控制器,其连接在各特殊值判断器与特殊值存储器之间,且连接各输出使能器;逻辑控制器被配置为将更新信号发送至特殊值存储器,且在同时接收到 多个更新信号时,将多个更新信号依次输入至特殊值存储器,并控制对应各更新信号的各获取单元的输出使能器依次导通。
本公开实施例的装置,可通过以上的硬件结构,实现以上的权重矩阵的数据获取的方法,在此不再详细描述。
其中,当有多个获取单元时,若涉及到两个属于获取单元的结构的交互,则若无特殊说明,应当是指同一个获取单元内部的两个结构进行交互。
其中,以上置中的多个结构,可以是多个相互独立的实体器件,也可以是多个结构集成在一起由一个实体器件实现,在此不再详细描述。
示例性地,参照图17,其为本公开实施例提供一种权重矩阵的数据获取的装置,包括地址产生器、特殊值存储器、预设值存储器,以及至少一个获取单元;其中,
地址产生器被配置为依次产生类型矩阵中各元素的地址,并输入至相应获取单元的类型矩阵存储器;
预设值存储器被配置为存储所有预设权重值,并将各预设权重值同步输入至所有获取单元的第三选通器;
特殊值存储器被配置为存储特殊值表,将特殊值表的当前特殊权重值输入至第三选通器,并在接收到更新信号时将当前特殊权重值更新为特殊值表的下一个特殊权重值;
每个获取单元包括:
类型矩阵存储器,被配置为存储类型矩阵,并根据接收到的地址,将类型矩阵的相应元素的类型输入至第三选通器和特殊值判断器;
特殊值判断器,被配置为在接收到的类型为特殊值型时,向特殊值存储器输出更新信号;
第三选通器,被配置为根据接收到的类型,从接收到的当前特殊权重值、各预设权重值中选择一个输出;
其中,类型矩阵与权重矩阵结构相同,其每个元素为权重矩阵中对应元素的权重值对应的类型,一个类型的数据量小于一个权重值的数据量;类型包括特殊值型和多个预设值型;每个预设值型对应一个预设权重值,特殊值型对应特殊权重值,除预设权重值外的其它权重值均为特殊权重值;特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
示例性地,参照图18,在一些实施例中,获取单元的数量为多个;
每个获取单元还包括:输出使能器,其连接第三选通器的输出;
装置还包括:逻辑控制器,其连接在各特殊值判断器与特殊值存储器之间,且连接各输出使能器;逻辑控制器被配置为将更新信号发送至特殊值存储器,且在同时接收到多个更新信号时,将多个更新信号依次输入至特殊值存储器,并控制对应各更新信号的各获取单元的输出使能器依次导通。
本公开实施例的装置,可通过以上的硬件结构,实现以上的权重矩阵的数据获取的方法,在此不再详细描述。
其中,当有多个获取单元时,若涉及到两个属于获取单元的结构的交互,则若无特殊说明,应当是指同一个获取单元内部的两个结构进行交互。
其中,以上置中的多个结构,可以是多个相互独立的实体器件,也可以是多个结构集成在一起由一个实体器件实现,在此不再详细描述。
图20为本公开实施例提供的一种电子设备的框图。
参照图20,本公开实施例提供了一种电子设备,该电子设备包括:至少一个处理器2001;至少一个存储器2002,以及一个或多个I/O接口2003,连接在处理器2001与存储器2002之间;其中,存储器2002存储有可被至少一个处理器2001执行的一个或多个计算机程序,一个或多个计算机程序被至少一个处理器2001执行,以使至少一个处理器2001能够执行上述的权重矩阵的数据存储方法,或者权重矩阵的数据获取方法。
本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序在被处理器/处理核执行时实现上述的权重矩阵的数据存储方法,或者权重矩阵的数据获取方法。计算机可读存储介质可以是易失性或非易失性计算机可读存储介质。
本公开实施例还提供了一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行上述权重矩阵的数据存储方法,或者权重矩阵的数据获取方法。
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读存储介质上,计算机可读存储介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。
如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读程序指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM)、静态随机存取存储器(SRAM)、闪存或其他存储器技术、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读程序指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。
这里所描述的计算机程序产品可以通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品示例性地体现为计算机存储介质,在另一个可选实施例中,计算机程序产品示例性地体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
本文已经公开了示例实施例,并且虽然采用了术语,但它们仅用于并仅应当被解释为一般说明性含义,并且不用于限制的目的。在一些实例中,对本领域技术人员显而易见的是,除非另外明确指出,否则可单独使用与特定实施例相结合描述的特征、特性和/或元素,或可与其他实施例相结合描述的特征、特性和/或元件组合使用。因此,本领域技术人员将理解,在不脱离由所附的权利要求阐明的本公开的范围的情况下,可进行各种形式和细节上的改变。

Claims (20)

  1. 一种权重矩阵的数据存储方法,包括:
    根据权重矩阵,生成编码阵列和特殊值表;
    存储所述编码阵列和所述特殊值表;
    其中,所述编码阵列和所述特殊值表所占的存储空间小于所述权重矩阵所占的存储空间;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
  2. 根据权利要求1所述的方法,其中,所述编码阵列包括连接矩阵和数据类型表;
    其中,所述连接矩阵与所述权重矩阵结构相同,且所述连接矩阵的元素为所述权重矩阵中对应元素的权重值的连接类型;至少部分所述连接类型的数据量小于对应的权重值的数据量,且所述连接类型分为有效连接和无效连接;
    所述数据类型表包括依次设置的、所述权重矩阵中有效连接的权重值对应的数据类型;至少部分所述数据类型的数据量小于对应的权重值的数据量,且所述数据类型包括特殊值型和多个第一预设值型,所述第一预设值型对应第一预设权重值,所述第一预设权重值为有效连接的预设权重值,所述特殊值型对应所述特殊权重值,除所述第一预设权重值外的其它有效连接的权重值属于特殊权重值。
  3. 根据权利要求2所述的方法,其中,在所述根据权重矩阵,生成编码阵列和特殊值表之前,所述方法还包括:
    根据所述权重矩阵确定其中的多个有效连接的权重值为所述第一预设权重值,并存储所述第一预设权重值。
  4. 根据权利要求2所述的方法,其中,所述连接类型的数据量为一位。
  5. 根据权利要求1所述的方法,其中,所述编码阵列包括类型矩阵;
    其中,所述类型矩阵与所述权重矩阵结构相同,且所述类型矩阵的元素为所述权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;所述类型包括特殊值型和多个第二预设值型;所述第二预设值型对应第二预设权重值,所述特殊值型对应所述特殊权重值,除所述第二预设权重值外的其它权重值属于特殊权重值。
  6. 根据权利要求5所述的方法,其中,所述第二预设权重值包括:
    空权重;
    至少一个预设的、非空的权重值。
  7. 根据权利要求5或6所述的方法,其中,在所述根据权重矩阵,生成编码矩阵和特殊值表之前,还包括:
    根据所述权重矩阵确定其中的多个权重值为所述第二预设权重值,并存储所述第二预设权重值。
  8. 一种权重矩阵的数据获取方法,包括:
    根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值;
    获取确定的权重值;
    其中,所述编码阵列和所述特殊值表所占的存储空间小于所述权重矩阵所占的存储空间;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
  9. 根据权利要求8所述的方法,其中,所述编码阵列包括连接矩阵和数据类型表;
    其中,所述连接矩阵与所述权重矩阵结构相同,且所述连接矩阵的元素为所述权重矩阵中对应元素的权重值的连接类型;至少部分所述连接类型的数据量小于对应的权重值的数据量,且所述连接类型分为有效连接和无效连接;
    所述数据类型表包括依次设置的、所述权重矩阵中有效连接的权重值对应的数据类型;至少部分所述数据类型的数据量小于对应的权重值的数据量,且所述数据类型包括特殊值型和多个第一预设值型,所述第一预设值型对应第一预设权重值,所述第一预设权重值为有效连接的预设权重值,所述特殊值型对应所述特殊权重值,除所述第一预设权重值外的其它有效连接的权重值属于特殊权重值。
  10. 根据权利要求9所述的方法,其中,所述根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值,包括:
    地址产生器依次产生所述连接矩阵中的元素的地址,并输入至连接矩阵存储器;
    所述连接矩阵存储器根据接收到的地址,将其中预存的连接矩阵的相应元素的连接类型输入至第一选通器和数据类型存储器;
    所述数据类型存储器在接收到有效连接的情况下,将其中预存的数据类型表的相应数据类型输入至第二选通器和特殊值判断器;
    预设值存储器将其中预存的第一预设权重值同步输入至所述第二选通器;
    所述特殊值判断器在接收到的数据类型为特殊值型的情况下,向特殊值存储器输出更新信号;
    所述特殊值存储器将其中预存的特殊值表的当前特殊权重值输入至所述第二选通器,并在接收到所述更新信号的情况下,将当前特殊权重值更新为所述特殊值表的下一个特殊权重值;
    所述第二选通器根据接收到的数据类型,从接收到的当前特殊权重值、所述第一预设权重值中选择一个输出;
    无效值存储器将其中预存的无效权重值输入至所述第一选通器;
    所述第一选通器根据接收到的连接类型,从接收到的无效权重值、所述第二选通器的输出中选择一个输出。
  11. 根据权利要求8所述的方法,其中,所述编码阵列包括类型矩阵;
    其中,所述类型矩阵与所述权重矩阵结构相同,且所述类型矩阵的元素为所述权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;所述类型包括特殊值型和多个第二预设值型;所述第二预设值型对应所述第二预设权重值,所述特殊值型对应所述特殊权重值,除所述第二预设权重值外的其它权重值属于特殊权重值。
  12. 根据权利要求11所述的方法,其中,所述根据预存的所述类型矩阵的元素的类型,以及预存的所述特殊值表、第二预设权重值,确定所述权重矩阵中对应元素的权重值包括:
    地址产生器依次产生所述类型矩阵中的元素的地址,并输入至类型矩阵存储器;
    所述类型矩阵存储器根据接收到的地址,将其中预存的类型矩阵的相应元素的类型输入至第三选通器和特殊值判断器;
    预设值存储器将其中预存的第二预设权重值同步输入至所述第三选通器;
    所述特殊值判断器在接收到的类型为特殊值型的情况下,向特殊值存储器输出更新信号;
    所述特殊值存储器将其中预存的特殊值表的当前特殊权重值输入至所述第三选通器,并在接收到所述更新信号的情况下将当前特殊权重值更新为特殊值表的下一个特殊权重值;
    所述第三选通器根据接收到的类型,从接收到的当前特殊权重值、所述第二预设权重值中选择一个输出。
  13. 根据权利要求8-12中任一项所述的方法,其中,在根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值之后,还包括:
    根据所确定的权重值,复原所述权重矩阵的至少部分区域,并将复原的权重矩阵的区域存储至临时存储空间;
    从所述临时存储空间获取所述权重矩阵的权重值。
  14. 一种权重矩阵的数据获取装置,包括:处理单元以及至少一个获取单元;
    所述处理单元,被配置为根据预存的编码阵列和特殊值表,确定权重矩阵中对应元素的权重值;
    所述获取单元,被配置为获取所述确定的权重值;
    其中,所述编码阵列和所述特殊值表所占的存储空间小于所述权重矩阵所占的存储空间;所述特殊值表包括依次设置的、权重矩阵中的所有特殊权重值。
  15. 根据权利要求14所述的装置,其中,所述编码阵列包括:连接矩阵和数据类型表,所述处理单元包括:地址产生器、特殊值存储器、无效值存储器、第一预设值存储器;其中,
    所述连接矩阵与所述权重矩阵结构相同,且所述连接矩阵的元素为所述权重矩阵中对应元素的权重值的连接类型;至少部分所述连接类型的数据量小于对应的权重值的数据量,且所述连接类型分为有效连接和无效连接;所述数据类型表包括依次设置的、所述权重矩阵中有效连接的权重值对应的数据类型;至少部分所述数据类型的数据量小于对应的权重值的数据量,且所述数据类型包括特殊值型和多个第一预设值型,所述第一预设值型对应第一预设权重值,所述第一预设权重值为有效连接的预设权重值,所述特殊值型对应所述特殊权重值,除所述第一预设权重值外的其它有效连接的权重值属于特殊权重值;
    所述地址产生器被配置为依次产生所述连接矩阵中的元素的地址,并输入至相应获取单元的连接矩阵存储器;
    所述第一预设值存储器被配置为存储所述第一预设权重值,并将所述第一预设权重值同步输入至所述获取单元的第二选通器;
    所述无效值存储器被配置为存储所述无效权重值,并输入至所述获取单元的第一选通器;
    所述特殊值存储器被配置为存储所述特殊值表,将所述特殊值表的当前特殊权重值输入至所述第二选通器,并在接收到更新信号的情况下将当前特殊权重值更新为特殊值表的下一个特殊权重值;
    所述获取单元包括:
    连接矩阵存储器,被配置为存储所述连接矩阵,并根据接收到的地址,将所述连接矩阵的相应元素的连接类型输入至第一选通器和数据类型存储器;
    所述数据类型存储器,被配置为在接收到有效连接的情况下,将其中预存的数据类型表的相应数据类型输入至所述第二选通器和特殊值判断器;
    所述特殊值判断器,被配置为在接收到的数据类型为特殊值型的情况下,向特殊值存储器输出更新信号;
    所述第二选通器,被配置为根据接收到的数据类型,从接收到的当前特殊权重值、所述第一预设权重值中选择一个输出;
    所述第一选通器,被配置为根据接收到的连接类型,从接收到的无效权重值、第二选通器的输出中选择一个输出。
  16. 根据权利要求14所述的装置,其中,所述编码阵列包括:类型矩阵;
    所述处理单元包括:地址产生器、特殊值存储器、第二预设值存储器;其中,
    所述类型矩阵与所述权重矩阵结构相同,且所述类型矩阵的元素为所述权重矩阵中对应元素的权重值的类型,至少部分类型的数据量小于对应的权重值的数据量;所述类型包括特殊值型和多个第二预设值型;所述第二预设值型对应第二预设权重值,所述特殊值型对应所述特殊权重值,除所述第二预设权重值外的其它权重值属于特殊权重值;
    所述地址产生器被配置为依次产生所述类型矩阵中的元素的地址,并输入至相应获取单元的类型矩阵存储器;
    所述第二预设值存储器被配置为存储所述第二预设权重值,并将所述第二预设权重值同步输入至所述获取单元的第三选通器;
    所述特殊值存储器被配置为存储所述特殊值表,将所述特殊值表的当前特殊权重值输入至所述第三选通器,并在接收到更新信号的情况下将当前特殊权重值更新为所述特殊值表的下一个特殊权重值;
    所述获取单元包括:
    类型矩阵存储器,被配置为存储类型矩阵,并根据接收到的地址,将所述类型矩阵的相应元素的类型输入至所述第三选通器和特殊值判断器;
    所述特殊值判断器,被配置为在接收到的类型为特殊值型的情况下,向所述特殊值存储器输出更新信号;
    所述第三选通器,被配置为根据接收到的类型,从接收到的当前特殊权重值、所述第二预设权重值中选择一个输出。
  17. 根据权利要求15或16所述的装置,其中,所述获取单元的数量为多个;
    所述获取单元还包括:输出使能器,且所述输出使能器连接第一选通器或第三选通器的输出;
    所述装置还包括:逻辑控制器,且所述逻辑控制器连接在所述特殊值判断器与所述特殊值存储器之间,且连接所述输出使能器;所述逻辑控制器被配置为将更新信号发送至所述特殊值存储器,且在同时接收到多个更新信号的情况下,将多个所述更新信号依次输入至所述特殊值存储器,并控制与所述更新信号对应的获取单元的输出使能器依次导通。
  18. 一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1-7中任一项所述的权重矩阵的数据存储方法,或者如权利要求8-13中任一所述的权重矩阵的数据获取方法。
  19. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时实现如权利要求1-7中任一项所述的权重矩阵的数据存储方法,或 者如权利要求8-13中任一所述的权重矩阵的数据获取方法。
  20. 一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,其中,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行用于实现如权利要求1-7中任一项所述的权重矩阵的数据存储的方法,或者如权利要求8-13中任一所述的权重矩阵的数据获取方法。
PCT/CN2022/095238 2021-05-27 2022-05-26 权重矩阵的数据存储方法、数据获取方法及装置、设备 WO2022247908A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/266,658 US20240046113A1 (en) 2021-05-27 2022-05-26 Data storage method, data acquisition method, data acquisition apparatus for a weight matrix, and device

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202110585727.0 2021-05-27
CN202110585872.9A CN114527930B (zh) 2021-05-27 2021-05-27 权重矩阵数据存储方法、数据获取方法和装置、电子设备
CN202110585872.9 2021-05-27
CN202110585727.0A CN114546251B (zh) 2021-05-27 2021-05-27 权重矩阵数据存储方法、数据获取方法和装置、电子设备

Publications (1)

Publication Number Publication Date
WO2022247908A1 true WO2022247908A1 (zh) 2022-12-01

Family

ID=84228444

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/095238 WO2022247908A1 (zh) 2021-05-27 2022-05-26 权重矩阵的数据存储方法、数据获取方法及装置、设备

Country Status (2)

Country Link
US (1) US20240046113A1 (zh)
WO (1) WO2022247908A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117852655B (zh) * 2024-02-27 2024-08-09 荣耀终端有限公司 利用大模型进行推理的方法和电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977704A (zh) * 2017-11-10 2018-05-01 中国科学院计算技术研究所 权重数据存储方法和基于该方法的神经网络处理器
CN111008698A (zh) * 2019-11-23 2020-04-14 复旦大学 用于混合压缩循环神经网络的稀疏矩阵乘法加速器
CN112668689A (zh) * 2019-10-16 2021-04-16 三星电子株式会社 进行多媒体数据处理的方法和设备
CN114527930A (zh) * 2021-05-27 2022-05-24 北京灵汐科技有限公司 权重矩阵数据存储方法、数据获取方法和装置、电子设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977704A (zh) * 2017-11-10 2018-05-01 中国科学院计算技术研究所 权重数据存储方法和基于该方法的神经网络处理器
CN112668689A (zh) * 2019-10-16 2021-04-16 三星电子株式会社 进行多媒体数据处理的方法和设备
CN111008698A (zh) * 2019-11-23 2020-04-14 复旦大学 用于混合压缩循环神经网络的稀疏矩阵乘法加速器
CN114527930A (zh) * 2021-05-27 2022-05-24 北京灵汐科技有限公司 权重矩阵数据存储方法、数据获取方法和装置、电子设备

Also Published As

Publication number Publication date
US20240046113A1 (en) 2024-02-08

Similar Documents

Publication Publication Date Title
US11348004B2 (en) Method of managing data representation for deep learning, method of processing data for deep learning and deep learning system performing the same
US10482380B2 (en) Conditional parallel processing in fully-connected neural networks
WO2022247908A1 (zh) 权重矩阵的数据存储方法、数据获取方法及装置、设备
US10248906B2 (en) Neuromorphic circuits for storing and generating connectivity information
US20190087723A1 (en) Variable isa vector-based compaction in distributed training of neural networks
JP2019515367A (ja) ニューラル・ネットワークのスパニング電力および面積の効率性を実装するための、省エネルギな多重ニューロシナプティック・コア
US20210150351A1 (en) Isa-based compression in distributed training of neural networks
TW202004493A (zh) 在向量處理器為基礎裝置中提供多重元件多重向量(memv)暫存器檔案存取
US10191881B2 (en) Modifications to a stream processing topology during processing of a data stream
CN105389677B (zh) 用于配置车辆的装置和方法
US10311557B2 (en) Automated tonal balancing
US11630696B2 (en) Messaging for a hardware acceleration system
US20220171619A1 (en) Neuromorphic processor and neuromorphic processing method
CN107273178A (zh) 配置虚拟化系统的方法和装置
CN114546251B (zh) 权重矩阵数据存储方法、数据获取方法和装置、电子设备
CN114527930B (zh) 权重矩阵数据存储方法、数据获取方法和装置、电子设备
CN105045873A (zh) 一种数据文件的推送方法、装置及系统
CN114492152A (zh) 更新网络模型的方法、图像分类的方法、语言建模的方法
CN109492759B (zh) 神经网络模型预测方法、装置和终端
CN109584020B (zh) 一种信息处理方法和电子设备
CN111461310A (zh) 处理神经网络模型的神经网络设备、神经网络系统和方法
KR102421323B1 (ko) Pcm 기반의 시냅스 소자 및 그 동작 방법
CN109634653B (zh) 一种基于组件化架构的资源配置方法及装置
US20240154894A1 (en) Systems and methods for cloud-native network slicing and testing-as-a-service with continuous integration and continuous delivery (ci/cd) capabilities
GB2572949A (en) Neural network

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22810632

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18266658

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22810632

Country of ref document: EP

Kind code of ref document: A1