Matrix processing method and matrix processor

The matrix processing method addresses high computing resource consumption by determining and offsetting matrix attribute information for neural network models, reducing resource and power usage through direct array processing.

CN119106226APending Publication Date: 2024-12-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310687203.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-09
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The consumption of computing resources is high in the conversion process of matrices for neural network models, leading to significant resource and power consumption.

Method used

A matrix processing method that determines initial and offset matrix attribute information to perform array conversion without using additional computing resources, allowing direct loading and processing by a preset array processing device.

Benefits of technology

Reduces computing resource and power consumption by constructing a converted feature matrix in a preset array without additional resources, enabling efficient matrix processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119106226A_ABST
    Figure CN119106226A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a matrix processing method and a matrix processor. The matrix processing method and the matrix processor can be applied to various scenes such as cloud technology, artificial intelligence, intelligent traffic and Internet of Vehicles. According to the method, to-be-processed feature matrixes of at least two dimensions of a neural network model can be acquired; determining initial matrix attribute information of the to-be-processed feature matrix under each dimension according to the vector information of the to-be-processed feature matrix; performing offset processing on the initial matrix attribute information to obtain offset matrix attribute information of the to-be-processed feature matrix under each dimension; performing array conversion processing on the to-be-processed feature matrix according to the initial matrix attribute information and the offset matrix attribute information to obtain converted feature matrixes arranged in a preset array under each dimension; and adopting a preset array processing device corresponding to the preset array to carry out loading processing on the converted feature matrix under each dimension. According to the invention, the consumption of computing resources and the power consumption of computer equipment can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a matrix processing method and a matrix processor. Background Art

[0002] With the development of neural network models, neural network models have been widely used in various fields. Among them, the use of neural network models by computer devices, such as application process or training process, will involve a large number of matrix operations. In the process of matrix operation by computer devices, the matrix needs to be converted before it can be processed by a preset array processing device. However, the conversion process of the matrix currently requires a large number of computing resources such as registers, which will result in the consumption of a large number of computing resources.

[0003] In summary, there is currently a problem of large consumption of computing resources in the use of neural network models. Summary of the invention

[0004] The embodiments of the present application provide a matrix processing method and a matrix processor, which can reduce the consumption of computing resources and lower power consumption.

[0005] A matrix processing method, comprising:

[0006] Obtain a feature matrix to be processed of at least two dimensions of the neural network model;

[0007] Determine the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed;

[0008] Performing offset processing on the initial matrix attribute information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension;

[0009] According to the initial matrix attribute information and the offset matrix attribute information, the feature matrix to be processed is subjected to array conversion processing to obtain a converted feature matrix arranged in a preset array in each dimension;

[0010] The converted feature matrix in each dimension is loaded and processed by using a preset array processing device corresponding to the preset array.

[0011] Accordingly, an embodiment of the present application provides a matrix processor, including:

[0012] The information generation module can be used to obtain the feature matrix to be processed in at least two dimensions of the neural network model; determine the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed; perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension;

[0013] The array conversion module can be used to obtain the initial matrix attribute information and the offset matrix attribute information sent by the information generation module, and perform array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information to obtain a converted feature matrix arranged in a preset array in each dimension;

[0014] The preset array processing device can be used to obtain the converted feature matrix sent by the array conversion module, and load and process the converted feature matrix in each dimension.

[0015] In some embodiments, the information generation module includes an information determination device and an information offset device; the information determination device can be used to obtain the feature matrix to be processed in at least two dimensions of the neural network model; according to the vector information of the feature matrix to be processed, the initial matrix attribute information of the feature matrix to be processed in each dimension is determined; the information offset device can be used to obtain the initial matrix attribute information sent by the information determination device, and perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0016] In some embodiments, the information offset device is used to obtain element position information of matrix elements in the feature matrix to be processed; according to the element position information, the initial matrix attribute information is offset to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0017] In some embodiments, the information offset device includes multiple information offset devices; the information determination device is used to determine the target information offset device corresponding to the initial matrix attribute information from the multiple information offset devices based on the element position information; the target information offset device is used to obtain the initial matrix attribute information sent by the information determination device, and perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0018] In some embodiments, the target information offset device can be used to obtain offset parameters corresponding to the element position information; according to the offset parameters, the initial matrix attribute information is offset to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0019] In some embodiments, the array conversion module can be used to store the matrix elements in the feature matrix to be processed in a preset storage space corresponding to the matrix attribute information based on the matrix attribute information composed of the initial matrix attribute information and the offset matrix attribute information, and obtain the stored matrix elements; according to the matrix attribute information and the stored matrix elements, perform array conversion processing on the feature matrix to be processed, and obtain a converted feature matrix arranged in a preset array in each dimension.

[0020] In some embodiments, the array conversion module includes an information grouping device and an information management device; the information grouping device can be used to group and process the matrix attribute information corresponding to the feature matrix to be processed according to the dimension of the feature matrix to be processed, and obtain a target matrix attribute information group, the target matrix attribute information group includes target matrix attribute information with corresponding relationships under different dimensions, wherein the target matrix attribute information belongs to matrix attribute information; the information management device can be used to obtain the target matrix attribute information group obtained by the information grouping device, and according to the target matrix attribute information group, store the matrix elements in the feature matrix to be processed in a preset storage space corresponding to the matrix attribute information, and obtain the stored matrix elements.

[0021] In some embodiments, the information management device is provided with a storage sub-device, which can be used to extract target matrix elements corresponding to the target matrix attribute information from the matrix elements of the feature matrix to be processed according to the target matrix attribute information group; store the target matrix elements in a preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements.

[0022] In some embodiments, the storage sub-device can be used to, if the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information of different dimensions are different, then within the same preset time, store the target matrix elements in the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements; if the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information of different dimensions are the same, then at an interval of candidate time, store the target matrix elements in the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements.

[0023] In some embodiments, the array conversion module includes an information grouping device and an information management device. The information grouping device can be used to detect storage conflict information of a preset storage space based on matrix attribute information; the information management device can be used to store the matrix elements in the feature matrix to be processed in the preset storage space corresponding to the matrix attribute information based on the storage conflict information to obtain the stored matrix elements.

[0024] In some embodiments, the information management device can be used to store the matrix elements in the feature matrix to be processed in the preset storage space corresponding to the matrix attribute information according to a first preset storage strategy if the storage conflict information indicates that there is a storage conflict for the matrix elements corresponding to the matrix attribute information, so as to obtain the stored matrix elements; if the storage conflict information indicates that there is no storage conflict for the matrix elements corresponding to the matrix attribute information, then according to a second preset storage strategy, store the matrix elements in the feature matrix to be processed in the preset storage space corresponding to the matrix attribute information, so as to obtain the stored matrix elements.

[0025] In some embodiments, the information management device is provided with a classification sub-device and a fusion sub-device; the classification sub-device is used to classify the matrix attribute information according to the dimension corresponding to the matrix attribute information to obtain the classified matrix attribute information corresponding to each dimension; the fusion sub-device is used to obtain the classified matrix attribute information obtained by the classification sub-device, and according to the classified matrix attribute information corresponding to each dimension, extract the target stored matrix elements corresponding to the classified matrix attribute information from the stored matrix elements, and fuse the target stored matrix elements of each dimension respectively to obtain the converted feature matrix arranged in a preset array under each dimension.

[0026] In some embodiments, the information generation module can be used to determine the vector field corresponding to the vector information in the feature matrix to be processed based on the vector information of the feature matrix to be processed; map the matrix elements in the vector field to obtain the element address information of the matrix elements; and generate the initial matrix attribute information of the feature matrix to be processed in each dimension based on the element address information.

[0027] In addition, an embodiment of the present application further provides a computer device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any matrix processing method provided in the embodiment of the present application.

[0028] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for loading by a processor to execute any matrix processing method provided in the embodiment of the present application.

[0029] In addition, an embodiment of the present application also provides a computer program product, including a computer program, which implements any matrix processing method provided in the embodiment of the present application when the computer program is executed by a processor.

[0030] The present application can obtain the feature matrix to be processed of at least two dimensions of the neural network model; determine the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed; perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension; perform array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information to obtain the converted feature matrix arranged in a preset array in each dimension; use the preset array processing device corresponding to the preset array to load the converted feature matrix in each dimension. Since the present application can determine the initial matrix attribute information of the feature matrix to be processed based on the vector information of the feature matrix to be processed of the neural network model, the initial matrix attribute information can be offset processed to obtain the offset matrix attribute information of the feature matrix to be processed, so that the converted feature matrix arranged in a preset array can be constructed without using the computing resources arranged in a preset array, so that the preset array processing device corresponding to the preset array can be directly used in the future to load the converted feature matrix, thereby reducing the consumption of computing resources and further reducing the power consumption of computer equipment. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0032] Figure 1 is a schematic diagram of a scenario of a matrix processing method provided in an embodiment of the present application;

[0033] Figure 2 1 is a flowchart of a matrix processing method provided in an embodiment of the present application;

[0034] Figure 3 is a schematic diagram of the structure of a matrix processor provided in an embodiment of the present application;

[0035] Figure 4 A schematic diagram of a preset array processing device provided in an embodiment of the present application;

[0036] Figure 5 It is a schematic diagram of the processing process of the matrix by the existing related technology provided in the embodiment of the present application;

[0037] Figure 6 2 is a schematic diagram of the process of the matrix processing method provided in the embodiment of the present application;

[0038] Figure 7A schematic diagram of the structure of a matrix to be processed provided in an embodiment of the present application;

[0039] Figure 8 A schematic diagram of initial matrix attribute information and offset matrix attribute information provided in an embodiment of the present application;

[0040] Fig. 9 A diagram showing the generation of matrix attribute information provided in an embodiment of the present application;

[0041] Fig.10 A second schematic diagram of the generation of matrix attribute information provided in an embodiment of the present application;

[0042] Fig.11 Three diagrams showing the generation of matrix attribute information provided in the embodiments of the present application;

[0043] Fig.12 Four schematic diagrams showing the generation of matrix attribute information provided in the embodiments of the present application;

[0044] Fig.13 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0046] The embodiments of the present application provide a matrix processing method, apparatus, computer device and computer readable storage medium. The matrix processor can be integrated in a computer device, which can be a server or a terminal.

[0047] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a laptop, a desktop computer, a smart speaker, a smart watch, a car terminal, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here. The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc.

[0048] Among them, the embodiments of the present application involve artificial intelligence (AI), which is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0049] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0050] For example, see Figure 1 Taking the matrix processor integrated in the computer device as an example, the computer device can obtain the feature matrix to be processed of at least two dimensions of the neural network model; determine the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed; perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension; perform array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information to obtain the converted feature matrix arranged in a preset array in each dimension; use the preset array processing device corresponding to the preset array to load the converted feature matrix in each dimension.

[0051] Among them, the neural network model can be any type of neural network model, and the type can include but is not limited to at least one of a convolutional neural network model, a generative adversarial neural network model and a self-attention neural network model.

[0052] The feature matrix to be processed may refer to a matrix related to the features of the object to be processed by the neural network model. The object to be processed may be, for example, an image, a text, or a voice, etc. The feature matrix to be processed may be a collection of matrix elements arranged in a rectangular array.

[0053] The dimensions of the feature matrix to be processed may include but are not limited to weight dimensions and feature dimensions.

[0054] The vector information may refer to relevant information of a row vector or a column vector in a feature matrix to be processed.

[0055] The preset array may refer to an array of elements arranged in the converted characteristic matrix, and may include a triangular array.

[0056] The preset array processing device may refer to a processing device for performing calculations on the converted feature matrix.

[0057] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0058] This embodiment will be described from the perspective of a matrix processor, which can be specifically integrated in a computer device, which can be a server or a terminal. The terminal can include a tablet computer, a laptop computer, a personal computer (PC), a wearable device, a virtual reality device, or other smart devices that can acquire data.

[0059] First of all, it should be noted that in the existing related technologies, when a computer device performs matrix operations, it is necessary to convert the matrix before processing it through a preset array processing device. However, the current matrix conversion processing requires the use of a large number of computing resources such as registers, which will result in the consumption of a large number of computing resources. Based on this, the present application provides a matrix processing method to reduce the consumption of computing resources, such as Figure 2 As shown, the specific process of the matrix processing method is shown in steps S201 to S205:

[0060] S201. Obtain a feature matrix to be processed of at least two dimensions of a neural network model.

[0061] The feature matrix to be processed may be a matrix generated by a neural network model.

[0062] In some application embodiments, the embodiments of the present application may use the feature matrices to be processed extracted from different neural network layers in the neural network model as feature matrices to be processed of different dimensions to obtain feature matrices to be processed of at least two dimensions.

[0063] In some application embodiments, the method for obtaining the feature matrix to be processed of at least two dimensions of the neural network model can be: obtaining the object to be processed; using the neural network model to perform feature extraction on the object to be processed to obtain an object feature matrix of the feature dimension of the object to be processed; using the neural network model to generate a weight matrix of the weight dimension corresponding to the object feature matrix; and generating the feature matrix to be processed of the neural network model based on the weight matrix and the object feature matrix.

[0064] S202: Determine initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed.

[0065] The initial matrix attribute information may refer to the information of the attributes related to the feature matrix to be processed obtained initially, and the attributes may include but are not limited to any one of the address attributes of the matrix elements in the feature matrix to be processed and the size attributes of the feature matrix to be processed.

[0066] In some application embodiments, the method for determining the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed can be: determining the vector field corresponding to the vector information in the feature matrix to be processed according to the vector information of the feature matrix to be processed; mapping the matrix elements in the vector field to obtain the element address information of the matrix elements; and generating the initial matrix attribute information of the feature matrix to be processed in each dimension according to the element address information.

[0067] The vector field may refer to a field storing matrix elements in a vector corresponding to vector information.

[0068] In one example, according to the vector information of the feature matrix to be processed, the method for determining the vector field corresponding to the vector information in the feature matrix to be processed can be: according to the position information of the row vector of the feature matrix to be processed in the feature matrix to be processed, the vector field corresponding to the vector information in the feature matrix to be processed is searched.

[0069] In one example, mapping the matrix elements in the vector field to obtain the element address information of the matrix elements may be performed by: obtaining a preset mapping strategy for the matrix elements; and mapping the matrix elements in the vector field according to the preset mapping strategy to obtain the element address information of the matrix elements.

[0070] The preset mapping strategy may refer to a preset strategy for performing mapping processing on matrix elements.

[0071] In one example, according to a preset mapping strategy, the matrix elements in the vector field are mapped to obtain the element address information of the matrix elements. The method can be: according to the preset mapping strategy, the element position information corresponding to the matrix elements in the vector field is mapped to obtain the element address information of the matrix elements.

[0072] In one example, mapping processing may be performed on the first matrix element in each row vector to obtain element address information of the matrix element.

[0073] S203: Perform offset processing on the initial matrix attribute information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension.

[0074] Since the present application needs to change the array arrangement of the matrix to be processed, based on this, the present application needs to perform offset processing on the initial matrix attribute information.

[0075] In some application embodiments, the initial matrix attribute information is offset processed to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension. The method can be: obtaining the element position information of the matrix elements in the feature matrix to be processed; based on the element position information, the initial matrix attribute information is offset processed to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0076] The matrix elements may refer to elements constituting the feature matrix to be processed.

[0077] In one example, the initial matrix attribute information is offset according to the element position information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension as in steps S2031 to S2032:

[0078] S2031. Determine the target information offset device corresponding to the initial matrix attribute information according to the element position information.

[0079] In one example, the method for determining the target information offset device corresponding to the initial matrix attribute information according to the element position information can be: obtaining the association relationship between the element position information and the target information offset device; and obtaining the target information offset device corresponding to the initial matrix attribute information according to the association relationship and the element position information.

[0080] In one example, the method of determining the information offset device corresponding to the initial matrix attribute information according to the element position information can be: obtaining the processing order of the information offset device; and determining the target information offset device corresponding to the initial matrix attribute information according to the correspondence between the element position information and the processing order.

[0081] Among them, according to the correspondence between the element position information and the processing order, the method of determining the target information offset device corresponding to the initial matrix attribute information can be: according to the correspondence between the element position information and the processing order, determining the target information offset device corresponding to the element position information; using the target information offset device corresponding to the element position information as the target information offset device corresponding to the initial matrix attribute information.

[0082] S2032. Performing an offset process on the initial matrix attribute information according to the target information offset device to obtain offset matrix attribute information of the feature matrix to be processed in each dimension.

[0083] In one example, a target information offset device is used to perform offset processing on the initial matrix attribute information, and the method for obtaining the offset matrix attribute information of the feature matrix to be processed in each dimension can be: obtaining the offset parameter corresponding to the element position information; and using the target information offset device to perform offset processing on the initial matrix attribute information according to the offset parameter to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0084] The offset parameter may be a parameter used to perform an offset process on the initial matrix attribute information. The offset parameter and the element position information may be in a one-to-one correspondence relationship.

[0085] Among them, the target information offset device performs an offset processing on the initial matrix attribute information according to the offset parameters, and the method for obtaining the offset matrix attribute information of the feature matrix to be processed in each dimension can be: obtaining the processing order of the target information offset device; according to the processing order of the target information offset device, the offset parameters and the initial matrix attribute information are sequentially fused through the target information offset device to obtain the fused matrix attribute information; for each dimension, the fused matrix attribute information is used as the offset matrix attribute information of the feature matrix to be processed in the dimension.

[0086] S204 , performing array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information, to obtain a converted feature matrix arranged in a preset array in each dimension.

[0087] In some application embodiments, according to the initial matrix attribute information and the offset matrix attribute information, the feature matrix to be processed is subjected to array conversion processing to obtain a converted feature matrix arranged in a preset array in each dimension as shown in steps S2041 to S2042:

[0088] S2041. According to the matrix attribute information composed of the initial matrix attribute information and the offset matrix attribute information, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

[0089] The matrix attribute information may include initial matrix attribute information and offset matrix attribute information.

[0090] There are many specific implementations of step S2041, such as the following method (I) and method (II):

[0091] Method (I): According to the matrix attribute information composed of the initial matrix attribute information and the offset matrix attribute information, the matrix elements in the feature matrix to be processed are stored in the preset storage space corresponding to the matrix attribute information. The method of obtaining the stored matrix elements can be as shown in steps A1 to A2:

[0092] A1. According to the dimension of the feature matrix to be processed, the matrix attribute information corresponding to the feature matrix to be processed is grouped and processed to obtain a target matrix attribute information group.

[0093] The target matrix attribute information group includes target matrix attribute information having corresponding relationships in different dimensions.

[0094] Among them, the target matrix attribute information belongs to the matrix attribute information.

[0095] In one example, for example, the dimension includes a feature dimension and a weight dimension, and the feature matrix to be processed includes an object feature matrix of the feature dimension and a weight matrix of the weight dimension; based on this, according to the dimension of the feature matrix to be processed, the matrix attribute information corresponding to the feature matrix to be processed is grouped and processed, and the method for obtaining the target matrix attribute information group can be: according to the feature dimension of the feature matrix to be processed, the first target matrix attribute information corresponding to the first target matrix element in the object feature matrix under the feature dimension is extracted from the matrix attribute information; according to the weight dimension of the feature matrix to be processed, the second target matrix attribute information corresponding to the first target matrix attribute information under the weight dimension is extracted from the matrix attribute information; according to the first target matrix attribute information and the second target matrix attribute information, a target matrix attribute information group is generated.

[0096] Among them, the matrix elements in the object feature matrix and the matrix elements in the weight matrix can be in one-to-one correspondence.

[0097] The second target matrix attribute information may be the target attribute information corresponding to the second target matrix element in the weight matrix. The second target matrix element in the weight matrix may be in a corresponding relationship with the first target matrix element in the object feature matrix; the position of the second target matrix element in the weight matrix is ​​the same as the position of the first target matrix element in the object feature matrix. For example, if the position of the second target matrix element in the weight matrix is ​​the first row and the first column, then the corresponding position of the first target matrix element in the object feature matrix is ​​the first row and the first column.

[0098] A2. According to the target matrix attribute information group, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

[0099] In one example, according to the target matrix attribute information group, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information, and the method for obtaining the stored matrix elements can be: according to the target matrix attribute information group, the target matrix elements corresponding to the target matrix attribute information are extracted from the matrix elements of the feature matrix to be processed; the target matrix elements are stored in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements.

[0100] Among them, there is a one-to-one correspondence between the target matrix elements and the target matrix attribute information.

[0101] The preset storage space may refer to a storage space used to store target matrix elements, and the preset storage space may be a temporary storage space.

[0102] In one example, the target matrix elements are stored in a preset storage space corresponding to the target matrix attribute information, and the method for obtaining the stored matrix elements can be: if the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information of different dimensions are different, then within the same preset time, the target matrix elements are respectively stored in the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements; if the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information of different dimensions are the same, then at an interval of candidate time, the target matrix elements are respectively stored in the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements.

[0103] The preset storage space may include a plurality of sub-preset storage spaces.

[0104] For example, the target matrix element includes a first target matrix element of a feature dimension and a second target matrix element of a weight dimension, and the sub-preset storage space includes a first sub-preset storage space and a second sub-preset storage space; when the sub-preset storage spaces corresponding to the first target matrix element and the second target matrix element are different, then within the same preset time, the first target matrix element is stored in the first sub-preset storage space, and the second target matrix element is stored in the second sub-preset storage space to obtain a stored matrix element corresponding to the first target matrix element and a stored matrix element corresponding to the second target matrix element.

[0105] Method (II): According to the matrix attribute information composed of the initial matrix attribute information and the offset matrix attribute information, the matrix elements in the feature matrix to be processed are stored in the preset storage space corresponding to the matrix attribute information. The method for obtaining the stored matrix elements can also be as shown in step B1 to step B2:

[0106] B1. Detect storage conflict information of a preset storage space according to matrix attribute information.

[0107] In one example, based on the matrix attribute information, a method for detecting the storage conflict information of the preset storage space can be: determining whether there are at least two preset storage spaces corresponding to the matrix attribute information that are the same; if so, determining that the storage conflict information of the preset storage space represents that there is a storage conflict in the matrix elements corresponding to the matrix attribute information; if not, determining that the storage conflict information of the preset storage space represents that there is no storage conflict in the matrix elements corresponding to the matrix attribute information.

[0108] In one example, a specific method for determining whether there are at least two sets of matrix attribute information corresponding to the same preset storage space may be: obtaining a mapping relationship between the matrix attribute information and the storage address of the preset storage space; and determining whether there are at least two sets of matrix attribute information corresponding to the same preset storage space based on the mapping relationship and the matrix attribute information.

[0109] B2. According to the storage conflict information, the matrix elements in the feature matrix to be processed are stored in the preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

[0110] In one example, according to the storage conflict information, the matrix elements in the feature matrix to be processed are stored in the preset storage space corresponding to the matrix attribute information, and the method for obtaining the stored matrix elements can be: if the storage conflict information indicates that the matrix elements corresponding to the matrix attribute information have a storage conflict, then according to the first preset storage strategy, the matrix elements in the feature matrix to be processed are stored in the preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements; if the storage conflict information indicates that the matrix elements corresponding to the matrix attribute information do not have a storage conflict, then according to the second preset storage strategy, the matrix elements in the feature matrix to be processed are stored in the preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

[0111] The first preset storage strategy and the second preset storage strategy are different strategies.

[0112] Among them, the first preset storage strategy can indicate that the matrix elements in the feature matrix to be processed are stored in the preset storage space in sequence to obtain the stored matrix elements. Specifically, based on the first preset storage strategy, the matrix elements with storage conflicts are stored according to the corresponding clock cycles. For example, the clock cycle includes a first clock cycle and a second clock cycle, and there is a storage conflict between the first matrix element and the second matrix element. Based on this, the first clock cycle and the second clock cycle need to be consumed to complete the storage of the first matrix element and the second matrix element respectively.

[0113] The second preset storage strategy may indicate that the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information within the same clock cycle to obtain the stored matrix elements.

[0114] S2042. Perform array conversion processing on the feature matrix to be processed according to the matrix attribute information and the stored matrix elements to obtain a converted feature matrix arranged in a preset array in each dimension.

[0115] In some application embodiments, the feature matrix to be processed is array-converted according to the matrix attribute information and the stored matrix elements to obtain the converted feature matrix arranged in a preset array in each dimension. The method can be: classifying the matrix attribute information according to the dimension corresponding to the matrix attribute information to obtain the classified matrix attribute information corresponding to each dimension; extracting the target stored matrix elements corresponding to the classified matrix attribute information from the stored matrix elements according to the classified matrix attribute information corresponding to each dimension; and fusing the target stored matrix elements of each dimension respectively to obtain the converted feature matrix arranged in a preset array in each dimension.

[0116] For example, when the dimension includes a feature dimension and a weight dimension, the classified matrix attribute information may include first classified matrix attribute information corresponding to the feature dimension, and second classified matrix attribute information corresponding to the weight dimension.

[0117] In one example, the target stored matrix elements of each dimension are fused separately to obtain a converted feature matrix arranged in a preset array in each dimension. The method can be: for each dimension, the target stored matrix elements are spliced ​​to obtain a converted feature matrix arranged in a preset array in the dimension.

[0118] S205 , using a preset array processing device corresponding to the preset array to load and process the converted feature matrix in each dimension.

[0119] In one embodiment of the application, a preset array processing device corresponding to the preset array is used to load and process the converted feature matrix in each dimension. The method can be: using a processing unit in the preset array processing device corresponding to the preset array to perform fusion operation processing on the converted feature matrices of different dimensions.

[0120] The present application can obtain the feature matrix to be processed of at least two dimensions of the neural network model; determine the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed; perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension; perform array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information to obtain the converted feature matrix arranged in a preset array in each dimension; use the preset array processing device corresponding to the preset array type to load the converted feature matrix in each dimension to process the feature matrix to be processed. Since the present application can determine the initial matrix attribute information of the feature matrix to be processed based on the vector information of the feature matrix to be processed of the neural network model, the initial matrix attribute information can be offset processed to obtain the offset matrix attribute information of the feature matrix to be processed, so that the converted feature matrix arranged in a preset array can be constructed without using the computing resources arranged in a preset array, so that the preset array processing device corresponding to the preset array type can be directly used in the future to load the converted feature matrix, thereby reducing the consumption of computing resources and further reducing power consumption.

[0121] According to the method described in the above embodiment, the following will be further described in detail with examples. In order to execute the above matrix processing method, the present application also provides a matrix processor to execute the matrix processing method, and the matrix processor can be integrated in a computer device, such as a server or a terminal, and the terminal can include a tablet computer, a laptop computer and / or a personal computer.

[0122] like Figure 3 As shown, the matrix processor may include an information generating module 100, an array conversion module 200 and a preset array processing device 300, wherein the preset array processing device 300 is as shown in FIG. Figure 4 shown.

[0123] The information generating module 100 may include an information determining device 101 and an information offset device 102. The information determining device 101 Figure 3 The information offset device 102 may include a first information offset device 1021 and a second information offset device 1022. The first information offset device 1021 is Figure 3 It can be marked as dff, the first information offset device 1021 can be provided with multiple and arranged in sequence, the first information offset device 1021 can be specifically a register; the second information offset device 1022 is Figure 3 The first information offset device 1021 and the second information offset device 1022 may be marked as adder, and the second information offset device 1022 may be provided with a plurality of devices and arranged in sequence, and the second information offset device 1022 may be specifically an adder. The first information offset device 1021 and the second information offset device 1022 may be electrically connected and correspond one to one.

[0124] The array conversion module 200 may include an information grouping device 201 and an information management device 202. The information grouping device 201 Figure 3 The information grouping device 201 may be electrically connected to the second information offset device 1022. The information management device 202 may include a storage sub-device 2021, a classification sub-device 2022, and a fusion sub-device 2023. The storage sub-device 2021 may be electrically connected to the second information offset device 1022. Figure 3 The storage sub-device 2021 can be electrically connected to the information grouping device 201; the classification sub-device 2022 can be marked as RMU. Figure 3 The classification sub-device 2022 may be marked as MUX, and a plurality of classification sub-devices 2022 may be provided, and the number of classification sub-devices 2022 may be consistent with the number of preset storage spaces set in the information management device 202, and the classification sub-device 2022 may be electrically connected to the storage sub-device 2021; the fusion sub-device 2023 may be provided in Figure 3 The fusion sub-device 2023 can be marked as MGU and can be electrically connected to the classification sub-device 2022.

[0125] The preset array processing device 300 may be as follows: Figure 4 As shown, the preset array processing device 300 may include target registers arranged in an array, such as Figure 4 As shown in the PE marked in the figure.

[0126] The above-mentioned information generating module 100, array conversion module 200 and preset array processing device 300 are further described below.

[0127] (1) Information generation module 100;

[0128] The information generation module 100 can be used to obtain the feature matrix to be processed in at least two dimensions of the neural network model; determine the initial matrix attribute information of the feature matrix to be processed in each dimension based on the vector information of the feature matrix to be processed; and perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0129] In some application embodiments, the information generation module 100 includes an information determination device 101 and an information offset device 102; the information determination device 101 can be used to obtain the feature matrix to be processed in at least two dimensions of the neural network model; according to the vector information of the feature matrix to be processed, determine the initial matrix attribute information of the feature matrix to be processed in each dimension; the information offset device 102 can be used to obtain the initial matrix attribute information sent by the information determination device, and offset the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0130] In some application embodiments, the information offset device 102 can be used to obtain element position information of matrix elements in the feature matrix to be processed; according to the element position information, the initial matrix attribute information is offset to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0131] In some application embodiments, the information offset device 102 may include multiple information offset devices; the information determination device is used to determine the target information offset device corresponding to the initial matrix attribute information from the multiple information offset devices based on the element position information; the target information offset device is used to obtain the initial matrix attribute information sent by the information determination device, and perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0132] In some application embodiments, the target information offset device in the information offset device 102 can be used to obtain offset parameters corresponding to the element position information; according to the offset parameters, the initial matrix attribute information is offset to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0133] In some application embodiments, the information generation module 100 can be used to determine the vector field corresponding to the vector information in the feature matrix to be processed based on the vector information of the feature matrix to be processed; map the matrix elements in the vector field to obtain the element address information of the matrix elements; and generate the initial matrix attribute information of the feature matrix to be processed in each dimension based on the element address information.

[0134] (2) array conversion module 200;

[0135] The array conversion module 200 can be used to obtain the initial matrix attribute information and the offset matrix attribute information sent by the information generation module, and perform array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information to obtain a converted feature matrix arranged in a preset array in each dimension.

[0136] In some application embodiments, the array conversion module 200 can be used to store the matrix elements in the feature matrix to be processed in a preset storage space corresponding to the matrix attribute information based on the matrix attribute information composed of the initial matrix attribute information and the offset matrix attribute information, and obtain the stored matrix elements; according to the matrix attribute information and the stored matrix elements, perform array conversion processing on the feature matrix to be processed, and obtain a converted feature matrix arranged in a preset array in each dimension.

[0137] In some application embodiments, the array conversion module 200 includes an information grouping device 201 and an information management device 202. The information grouping device 201 can be used to group and process the matrix attribute information corresponding to the feature matrix to be processed according to the dimension of the feature matrix to be processed, so as to obtain a target matrix attribute information group. The target matrix attribute information group includes target matrix attribute information with corresponding relationships under different dimensions, wherein the target matrix attribute information belongs to matrix attribute information; the information management device 202 can be used to obtain the target matrix attribute information group obtained by the information grouping device, and according to the target matrix attribute information group, store the matrix elements in the feature matrix to be processed in a preset storage space corresponding to the matrix attribute information, so as to obtain the stored matrix elements.

[0138] In some application embodiments, the information management device 202 is provided with a storage sub-device 2021, which can be used to extract target matrix elements corresponding to the target matrix attribute information from the matrix elements of the feature matrix to be processed according to the target matrix attribute information group; store the target matrix elements in a preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements.

[0139] In some application embodiments, the storage sub-device 2021 can be used to, if the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information of different dimensions are different, then, within the same preset time, the target matrix elements are respectively stored in the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements; if the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information of different dimensions are the same, then, at an interval of candidate time, the target matrix elements are respectively stored in the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements.

[0140] In some application embodiments, the information grouping device 201 can be used to detect storage conflict information of a preset storage space based on matrix attribute information; the information management device 202 can be used to store the matrix elements in the feature matrix to be processed in the preset storage space corresponding to the matrix attribute information based on the storage conflict information to obtain the stored matrix elements.

[0141] In some application embodiments, the information management device 202 can be used to store the matrix elements in the feature matrix to be processed in the preset storage space corresponding to the matrix attribute information according to a first preset storage strategy if the storage conflict information indicates that there is a storage conflict for the matrix elements corresponding to the matrix attribute information, so as to obtain the stored matrix elements; if the storage conflict information indicates that there is no storage conflict for the matrix elements corresponding to the matrix attribute information, then according to a second preset storage strategy, store the matrix elements in the feature matrix to be processed in the preset storage space corresponding to the matrix attribute information, so as to obtain the stored matrix elements.

[0142] In some application embodiments, the information management device 202 may be provided with a classification sub-device 2022 and a fusion sub-device 2023; the classification sub-device 2022 is used to classify the matrix attribute information according to the dimension corresponding to the matrix attribute information, and obtain the classified matrix attribute information corresponding to each dimension; the fusion sub-device 2023 is used to obtain the classified matrix attribute information obtained by the classification sub-device, and according to the classified matrix attribute information corresponding to each dimension, extract the target stored matrix elements corresponding to the classified matrix attribute information from the stored matrix elements, and fuse the target stored matrix elements of each dimension respectively, to obtain the converted feature matrix arranged in a preset array under each dimension.

[0143] (3) Preset array processing device 300;

[0144] The preset array processing device 300 can be used to obtain the converted feature matrix sent by the array conversion module, and load the converted feature matrix in each dimension.

[0145] The information generation module of the present application can be used to obtain the feature matrix to be processed in at least two dimensions of the neural network model; determine the initial matrix attribute information of the feature matrix to be processed in each dimension based on the vector information of the feature matrix to be processed; perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension; the array conversion module can be used to perform array conversion processing on the feature matrix to be processed based on the initial matrix attribute information and the offset matrix attribute information to obtain the converted feature matrix arranged in a preset array in each dimension; the preset array processing device can be used to load the converted feature matrix in each dimension. Since the present application can determine the initial matrix attribute information of the feature matrix to be processed based on the vector information of the feature matrix to be processed of the neural network model, the initial matrix attribute information can be offset to obtain the offset matrix attribute information of the feature matrix to be processed, so that a converted feature matrix arranged in a preset array can be constructed without using computing resources arranged in a preset array, so that the preset array processing device corresponding to the preset array type can be directly used to load and process the converted feature matrix, thereby reducing the consumption of computing resources and further reducing the power consumption of computer equipment.

[0146] According to the method described in the above embodiment, the following is further described in detail with examples.

[0147] In this embodiment, the matrix processor is specifically integrated in a computer device, which is a server. The matrix processor can be integrated with an AI processor of the computer device.

[0148] First of all, it should be noted that in the existing related technologies, computer devices use AI processors to operate on relevant data of neural network models, such as matrices. Matrix operations will occupy most of the computing resources of the AI ​​processor. For example, when the neural network model has a convolutional layer or a fully connected layer, the AI ​​processor needs to use a large amount of computing resources such as computing units to realize the operation of the convolutional layer or the fully connected layer. Among them, the AI ​​processor can be integrated on the computer device, such as integrated on the CPU of the computer device.

[0149] Among them, in the process of computer equipment performing matrix operations, it is necessary to first convert the matrix to form a triangular matrix, and then input the triangular matrix into a preset array processing device for processing. The preset array processing device can use a two-dimensional systolic array to perform operations on the triangular matrix.

[0150] However, currently, the conversion of matrices into triangular matrices requires the use of a large amount of computing resources, such as a triangular array composed of registers. If the size of the systolic array is larger, the demand for registers required for the triangular matrix will be greater, which will result in the consumption of a large amount of computing resources.

[0151] For example, Figure 5 As shown, in the existing related technology, two matrices such as the first matrix and the second matrix are read. Figure 5 fm_tf in the example can be a first array for converting a first matrix into a triangular matrix, and wt_tf can be a second array for converting a second matrix into a triangular matrix. The first array and the second array are both strongly related to the specifications of the systolic array. For example, assuming that the systolic array is K rows and M columns, and w is the data bit width, if the processed matrix is ​​FP32 type data, w = 32 bits, then the first array fm_tf requires K*(K-1) / 2*w bit registers, and the second array wt_tf requires M*(M-1) / 2*w bit registers.

[0152] Specifically, assuming that the systolic array specification is 16 rows and 16 columns, and the processed matrix is ​​FP32 type data, the registers used by the first array fm_tf and the second array wt_tf are both 16*(16-1) / 2*32bit=3840bit, consuming a total of 7680bit registers, which will consume a large number of registers, and the registers will also occupy a large area in the AI ​​processor. Moreover, when the first array fm_tf and the second array wt_tf are in the working state, each time the matrix is ​​output to the first array fm_tf and the second array wt_tf, the registers in the first array fm_tf and the second array wt_tf need to be in a flipping state for a long time, which will cause the power consumption of the computer device to be relatively large.

[0153] Regarding the above, Figure 6 As shown, the embodiment of the present application provides a matrix processing method, and the specific process is shown in steps S401 to S407:

[0154] S401. The computer device obtains a feature matrix to be processed of at least two dimensions of a neural network model.

[0155] Specifically, the present application can obtain an object to be processed; use a neural network model to extract features of the object to be processed to obtain an object feature matrix of the feature dimension of the object to be processed; use a neural network model to generate a weight matrix of the weight dimension corresponding to the object feature matrix; based on the weight matrix and the object feature matrix, generate a feature matrix to be processed of the neural network model; then, store the feature matrix to be processed in a memory.

[0156] Then, the computer device can directly extract the feature matrix to be processed of at least two dimensions of the neural network model from the memory.

[0157] Here, it is explained that the present application can use a matrix processor to process the feature matrix to be processed to obtain a transformed feature matrix. The matrix processor can be as follows: Figure 3 As shown, the introduction of the matrix processor is mentioned above and will not be repeated here.

[0158] S402: The computer device determines initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed.

[0159] In some application embodiments, the method for determining the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed can be: determining the vector field corresponding to the vector information in the feature matrix to be processed according to the vector information of the feature matrix to be processed; mapping the matrix elements in the vector field to obtain the element address information of the matrix elements; and generating the initial matrix attribute information of the feature matrix to be processed in each dimension according to the element address information.

[0160] Among them, the element address information can be used as the initial matrix attribute information.

[0161] In one example, mapping the matrix elements in the vector field to obtain the element address information of the matrix elements may be performed by: obtaining a preset mapping strategy for the matrix elements; and mapping the element position information corresponding to the matrix elements in the vector field according to the preset mapping strategy to obtain the element address information of the matrix elements.

[0162] Based on the above, specifically, the embodiment of the present application is described by taking the feature matrix to be processed as an example, including a weight matrix of a weight dimension and an object feature matrix of a feature dimension. Figure 3 As shown, the present application may initiate an attribute information generation request to the information determination device 101, and the attribute information generation request may include a first attribute information generation request fm_req for the object feature matrix, and a second attribute information generation request wt_req for the weight matrix.

[0163] Among them, for the first attribute information generation request fm_req, the information determination device 101 generates the request fm_req based on the first attribute information, and determines the vector field of each row vector in the object feature matrix according to the vector information of the object feature matrix; then, the preset mapping strategy can be used to map the element position information corresponding to the first matrix element in the vector field to obtain the element address information of the first matrix element; the element address information is used as the initial matrix attribute information.

[0164] The way in which the information determining device 101 generates the initial matrix attribute information for the second attribute information generation request wt_req is the same as the way in which the information determining device 101 generates the initial matrix attribute information based on the first attribute information generation request fm_req, which will not be repeated here.

[0165] The information determining device 101 may generate element address information of the first matrix element of a row vector every other clock cycle.

[0166] For example, the present application uses a systolic array with 16 rows and 16 columns and a data type of the matrix to be processed as FP32 as an example. After the present application uses the information determination device 101 to generate element address information, each element address information can be delayed through 15 levels of beat logic, and the element address information is offset once after each level of beat logic. Then, one element address information can generate 15 offset address information. The offset address information can be the offset matrix attribute information described below.

[0167] The specific method of generating the offset matrix attribute information may refer to the following steps S403 and S404.

[0168] S403: The computer device obtains element position information of matrix elements in the feature matrix to be processed.

[0169] In an application embodiment, element position information of the matrix elements in the feature matrix to be processed may be extracted based on the vector field where the matrix elements in the feature matrix to be processed are located.

[0170] It can be understood here that the vector field may be pre-stored with element position information.

[0171] S404: The computer device performs an offset process on the initial matrix attribute information according to the element position information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0172] In one example, the initial matrix attribute information is offset according to the element position information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension as in steps S2031 to S2032:

[0173] S2031. Determine the target information offset device corresponding to the initial matrix attribute information according to the element position information.

[0174] The target information offset device may refer to a register dff.

[0175] S2032: Use a target information offset device to perform offset processing on the initial matrix attribute information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension.

[0176] In one example, a target information offset device is used to perform offset processing on the initial matrix attribute information, and the method for obtaining the offset matrix attribute information of the feature matrix to be processed in each dimension can be: obtaining the offset parameter corresponding to the element position information; and using the target information offset device to perform offset processing on the initial matrix attribute information according to the offset parameter to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

[0177] This application can use Figure 3 The register dff and the adder adder shown process the initial matrix attribute information to obtain the offset matrix attribute information.

[0178] Here we use a practical example to illustrate. For example, the structure of the matrix to be processed is as follows Figure 7 As shown, Figure 7 The matrix element of the first column in is the first matrix element of each row vector in the matrix to be processed. After processing from step S402 to step S404, the initial matrix attribute information and the offset matrix attribute information of the matrix to be processed can be obtained. Figure 7 Marking, such as Figure 8 As shown, Figure 8 The circled part is the initial matrix attribute information.

[0179] Specifically, the initial matrix attribute information can be generated by the information determination device 101, and then the offset matrix attribute information is generated by using the register dff and the adder adder. It should be noted here that for each dimension of the matrix to be processed, the obtained initial matrix attribute information and the offset matrix attribute information can form a triangular attribute information matrix.

[0180] Based on the above, the generation process of matrix attribute information after offset can be seen in Figures 9 to 12 First of all, it should be noted that the register dff may include multiple registers, and here the register dff includes the first register dff0, the second register dff1 and the third register dff2 as an example for explanation. The processing order of the registers may be the first register dff0, the second register dff1 and the third register dff2.

[0181] For example, Fig. 9As shown, in the 0th clock cycle T0, the information determination device 101 generates initial matrix attribute information a[0,0], and the initial matrix attribute information a[0,0] is output as the 0th row of the triangulated attribute information matrix. a[0,0] may refer to the initial matrix attribute information of the matrix element in the 1st row and the 1st column in the matrix to be processed.

[0182] Then, if Fig.10 As shown, in the first clock cycle T1, the initial matrix attribute information a[0,0] is transferred to the first register dff0, and a[0,0] is added with the offset parameter 1 in the adder adder to obtain the offset matrix attribute information a[0,1], and a[0,1] may refer to the offset matrix attribute information of the matrix element in the first row and the second column in the matrix to be processed. The present application may use the offset matrix attribute information a[0,1] as the output of the first row of the triangulated attribute information matrix.

[0183] Fig.10 In the example, the information determination device 101 generates initial matrix attribute information a[1,0], where a[1,0] is the output of the 0th row of the triangulated attribute information matrix. a[1,0] may refer to the initial matrix attribute information of the matrix element in the 2nd row and the 1st column in the matrix to be processed.

[0184] Then, if Fig.11 As shown, in the second clock cycle T2, the initial matrix attribute information a[0,0] is transferred to the second register dff1, and the initial matrix attribute information a[0,0] is added with the offset parameter 2 in the adder adder to obtain the offset matrix attribute information a[0,2], and the offset matrix attribute information a[0,2] is used as the output of the second row of the triangularized attribute information matrix. Among them, a[0,2] can refer to the offset matrix attribute information of the matrix element in the first row and the third column in the matrix to be processed.

[0185] Fig.11 In the process, the initial matrix attribute information a[1,0] is transferred to the first register dff0, and the initial matrix attribute information a[1,0] is added by 1 in the adder adder to obtain the offset matrix attribute information a[1,1], a[1,1] may refer to the offset matrix attribute information of the matrix element in the 2nd row and the 2nd column in the matrix to be processed, and the offset matrix attribute information a[1,1] is output as the first row of the triangulated attribute information matrix.

[0186] Fig.11 In the example, the information determining device 101 generates initial matrix attribute information a[2,0] as the output of the 0th row of the triangularized attribute information matrix. Wherein, a[2,0] may refer to the initial matrix attribute information of the matrix element at the 3rd row and the 1st column in the matrix to be processed.

[0187] And so on, such as Fig.12 As shown, in the third clock cycle T3, the initial matrix attribute information a[3,0] and the offset matrix attribute information a[2,1], a[1,2], and a[0,3] are output.

[0188] S405. The computer device stores the matrix elements in the feature matrix to be processed in a preset storage space corresponding to the matrix attribute information according to the matrix attribute information formed by the initial matrix attribute information and the offset matrix attribute information, and obtains the stored matrix elements.

[0189] The matrix attribute information may include initial matrix attribute information and offset matrix attribute information.

[0190] In this application, the matrix attribute information of the feature dimension may include multiple, such as Figure 3 As shown in the labels fm_to_bg0, fm_to_bg1, ..., fm_to_bg15, each label in fm_to_bg0, fm_to_bg1, ..., fm_to_bg15 can represent the matrix attribute information of the matrix elements in the object feature matrix corresponding to the feature dimension. For example, fm_to_bg0 represents the matrix attribute information of the first matrix element in the object feature matrix; fm_to_bg1 represents the matrix attribute information of the second matrix element in the object feature matrix; and so on, fm_to_bg15 represents the matrix attribute information of the sixteenth matrix element in the object feature matrix.

[0191] The matrix attribute information of the weight dimension can include multiple, such as Figure 3 As shown in the labels wt_to_bg0, wt_to_bg1, ..., wt_to_bg15, each label in wt_to_bg0, wt_to_bg1, ..., wt_to_bg15 can represent the matrix attribute information of the matrix elements in the weight matrix corresponding to the weight dimension. For example, wt_to_bg0 represents the matrix attribute information of the first matrix element in the weight matrix; wt_to_bg1 represents the matrix attribute information of the second matrix element in the weight matrix; and so on, wt_to_bg15 represents the matrix attribute information of the sixteenth matrix element in the weight matrix.

[0192] Since the matrix elements in the feature matrix to be processed may be stored in the same preset storage space, there may be storage conflicts. Based on this, the present application needs to use the matrix attribute information corresponding to the matrix elements to determine whether there are conflicts between the matrix elements. Based on this, the method of step S405 of the present application can be as shown in step B1 to step B2:

[0193] B1. Detect storage conflict information of a preset storage space according to matrix attribute information.

[0194] B2. According to the storage conflict information, the matrix elements in the feature matrix to be processed are stored in the preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

[0195] Since the present application has a matrix to be processed with at least two dimensions, based on this, the present application can group and store the matrix elements. Based on this, the specific method of step S405 can be shown in steps A1 to A2:

[0196] A1. According to the dimension of the feature matrix to be processed, the matrix attribute information corresponding to the feature matrix to be processed is grouped and processed to obtain a target matrix attribute information group.

[0197] The target matrix attribute information group includes target matrix attribute information having corresponding relationships in different dimensions.

[0198] In one example, for example, the dimension includes a feature dimension and a weight dimension, and the feature matrix to be processed includes an object feature matrix of the feature dimension and a weight matrix of the weight dimension; based on this, according to the dimension of the feature matrix to be processed, the matrix attribute information corresponding to the feature matrix to be processed is grouped and processed, and the method for obtaining the target matrix attribute information group can be: according to the feature dimension of the feature matrix to be processed, the first target matrix attribute information corresponding to the first target matrix element in the object feature matrix under the feature dimension is extracted from the matrix attribute information; according to the weight dimension of the feature matrix to be processed, the second target matrix attribute information corresponding to the first target matrix attribute information under the weight dimension is extracted from the matrix attribute information; according to the first target matrix attribute information and the second target matrix attribute information, a target matrix attribute information group is generated.

[0199] Specifically, for example, the present application can generate a storage request for a matrix element through the information grouping device 201. Based on the storage request, the present application can use the dimension of the feature matrix to be processed to group the matrix attribute information corresponding to the feature matrix to be processed to obtain a target matrix attribute information group. Among them, the present application can take the aforementioned fm_to_bg0 and wt_to_bg0 as a target matrix attribute information group; take fm_to_bg1 and wt_to_bg1 as a target matrix attribute information group, and so on, take fm_to_bg15 and wt_to_bg15 as a target matrix attribute information group.

[0200] A2. According to the target matrix attribute information group, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

[0201] In one example, according to the target matrix attribute information group, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information, and the method for obtaining the stored matrix elements can be: according to the target matrix attribute information group, the target matrix elements corresponding to the target matrix attribute information are extracted from the matrix elements of the feature matrix to be processed; the target matrix elements are stored in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements.

[0202] In one example, the target matrix elements are stored in a preset storage space corresponding to the target matrix attribute information, and the method for obtaining the stored matrix elements can be: if the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information of different dimensions are different, then within the same preset time, the target matrix elements are respectively stored in the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements; if the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information of different dimensions are the same, then at an interval of candidate time, the target matrix elements are respectively stored in the sub-preset storage spaces in the preset storage space corresponding to the target matrix attribute information to obtain the stored matrix elements.

[0203] Specifically, for example, the present application may be Figure 3 The storage sub-device 2021 shown performs storage processing on the matrix elements. The storage sub-device 2021 of the present application may include multiple storage sub-devices 2021, each storage sub-device 2021 may manage a preset storage space, wherein the preset storage space may include multiple sub-preset storage spaces, for example, the preset storage space of the present application may include a first sub-preset storage space bank0 and a second sub-preset storage space bank1.

[0204] Based on the above, after the target matrix attribute information group is obtained by the information grouping device 201, the target matrix attribute information group is sent to the storage sub-device 2021. If the sub-preset storage spaces corresponding to the target matrix attribute information in the same target matrix attribute information group are different, then the target matrix elements of the target matrix attribute information in the same target matrix attribute information group can be stored in the sub-preset storage space corresponding to the target matrix attribute information within the same preset time, such as one clock cycle. For example, the target matrix element corresponding to fm_to_bg0 in the target matrix attribute information group is stored in the first sub-preset storage space bank0; the target matrix element corresponding to wt_to_bg0 in the target matrix attribute information group is stored in the second sub-preset storage space bank1.

[0205] If the sub-preset storage spaces corresponding to the target matrix attribute information in the same target matrix attribute information group are the same, then the candidate time can be separated, for example, into two consecutive time periods, and the target matrix elements can be stored in the sub-preset storage spaces respectively. For example, through the storage sub-device 2021, one of the target matrix elements is preferentially stored in the first time period; and the other target matrix element is stored in the second time period.

[0206] S406. The computer device performs array conversion processing on the feature matrix to be processed according to the matrix attribute information and the stored matrix elements to obtain a converted feature matrix arranged in a preset array in each dimension.

[0207] In some application embodiments, the feature matrix to be processed is array-converted according to the matrix attribute information and the stored matrix elements to obtain the converted feature matrix arranged in a preset array in each dimension. The method can be: classifying the matrix attribute information according to the dimension corresponding to the matrix attribute information to obtain the classified matrix attribute information corresponding to each dimension; extracting the target stored matrix elements corresponding to the classified matrix attribute information from the stored matrix elements according to the classified matrix attribute information corresponding to each dimension; and fusing the target stored matrix elements of each dimension respectively to obtain the converted feature matrix arranged in a preset array in each dimension.

[0208] For example, when the dimension includes a feature dimension and a weight dimension, the classified matrix attribute information may include first classified matrix attribute information corresponding to the feature dimension, and second classified matrix attribute information corresponding to the weight dimension.

[0209] In one example, the target stored matrix elements of each dimension are fused separately to obtain a converted feature matrix arranged in a preset array in each dimension. The method can be: for each dimension, the target stored matrix elements are spliced ​​to obtain a converted feature matrix arranged in a preset array in the dimension.

[0210] Specifically, for example, Figure 3 The fusion sub-device 2023 shown can read the target stored matrix elements of the corresponding channel of the multiplexer from the preset storage space through the classification sub-device 2022 based on the classified matrix attribute information, and then merge the target stored matrix elements of each dimension in the fusion sub-device 2023 to obtain the converted feature matrix arranged in a preset array in each dimension. Among them, the classification sub-device 2022 can be a multiplexer.

[0211] Among them, a register group can be designed in the fusion sub-device 2023, which can be used to cache the target stored matrix elements read from the preset storage space.

[0212] When the target stored matrix elements are merged and collected in the register group of the fusion sub-device 2023, the complete converted feature matrix arranged in a preset array can be output to the preset array processing device.

[0213] If there is a storage conflict between the target matrix elements as mentioned above, the register group of the fusion sub-device 2023 needs to wait for multiple clock cycles before collecting the target stored matrix elements.

[0214] S407, the computer device uses the preset array processing device corresponding to the preset array to load and process the converted feature matrix in each dimension.

[0215] In one embodiment of the application, a preset array processing device corresponding to the preset array is used to load and process the converted feature matrix in each dimension. The method can be: using a processing unit in the preset array processing device corresponding to the preset array to perform fusion operation processing on the converted feature matrices of different dimensions.

[0216] Specifically, if Figure 4 As shown, the preset sorting processor may include multiple processing units PE, each processing unit PE can process FP32*FP32 multiplication operations and addition operations. Through the aforementioned matrix processor, the first converted feature matrix fm_rdata corresponding to the feature dimension and the second converted feature matrix wt_rdata corresponding to the weight dimension can be output.

[0217] It can be understood here that the first converted feature matrix fm_rdata and the second converted feature matrix wt_rdata do not need to undergo a triangular delay operation like the existing related art. The first converted feature matrix fm_rdata can be directly input from the upper side of the preset array processing device, and the second converted feature matrix wt_rdata can be directly input from the left side of the preset array processing device. Then, the processing unit in the preset array processing device corresponding to the preset array is used to perform a fusion operation on the first converted feature matrix fm_rdata and the second converted feature matrix wt_rdata to obtain fused data. The fused data can be output from the lower side of the preset array processing device to the accumulation unit acc for accumulation processing.

[0218] Based on the above, it can be understood that for a systolic array with a specification of 16 rows and 16 columns and a data type of FP32, the existing solution needs to consume 7680-bit registers for triangulation and beat processing. The matrix processor of the present application only needs to consume 15*16bit=240-bit registers and 15 adders. The overall computing resources consumed by the present application are greatly reduced.

[0219] This application places the generation logic of the triangulated matrix in advance to the generation stage of the initial matrix attribute information and the offset matrix attribute information. This application only performs offset processing on the initial matrix attribute information generated by the information determination device 101, that is, delays the clock cycle, and then performs an addition operation on the initial matrix attribute information to obtain the offset matrix attribute information. This application achieves the generation of triangulated matrix attribute information at a very low cost, and the area of ​​computer resources is greatly reduced. Moreover, since this application eliminates two triangulated arrays, power consumption can be greatly reduced, and in the layout and routing stage of the AI ​​processor, the dense triangulated register group corresponding to the triangulated array is reduced, reducing the congestion risk of layout and routing.

[0220] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0221] The present application can obtain the feature matrix to be processed of at least two dimensions of the neural network model; determine the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed; perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension; perform array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information to obtain the converted feature matrix arranged in a preset array in each dimension; use the preset array processing device corresponding to the preset array to load the converted feature matrix in each dimension. Since the present application can determine the initial matrix attribute information of the feature matrix to be processed based on the vector information of the feature matrix to be processed of the neural network model, the initial matrix attribute information can be offset processed to obtain the offset matrix attribute information of the feature matrix to be processed, so that the converted feature matrix arranged in a preset array can be constructed without using the computing resources arranged in a preset array, so that the preset array processing device corresponding to the preset array can be directly used in the future to load the converted feature matrix, thereby reducing the consumption of computing resources and further reducing the power consumption of computer equipment.

[0222] The present application also provides a computer device, such as Fig.13 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:

[0223] The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that Fig.13The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:

[0224] The processor 401 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the computer device and processes data. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and computer programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.

[0225] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0226] The computer device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0227] The computer device may further include an input unit 404, which may be used to receive input digital or character information communications and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0228] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the computer device will load the executable files corresponding to the processes of one or more computer programs into the memory 402 according to the following instructions, and the processor 401 will run the computer programs stored in the memory 402, thereby realizing various functions, as follows:

[0229] Obtain feature matrices to be processed in at least two dimensions of a neural network model; determine initial matrix attribute information of the feature matrix to be processed in each dimension based on vector information of the feature matrix to be processed; perform offset processing on the initial matrix attribute information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension; perform array conversion processing on the feature matrix to be processed based on the initial matrix attribute information and the offset matrix attribute information to obtain a converted feature matrix arranged in a preset array in each dimension; use a preset array processing device corresponding to the preset array to load the converted feature matrix in each dimension.

[0230] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0231] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0232] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program can be loaded by a processor to execute any matrix processing method provided in the embodiment of the present application.

[0233] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0234] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0235] Since the instructions stored in the computer-readable storage medium can execute the steps in any matrix processing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any matrix processing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0236] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementations provided in the above embodiments.

[0237] The above is a detailed introduction to a matrix processing method and a matrix processor provided in an embodiment of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A matrix processing method, It is characterized in that include: Obtain a feature matrix to be processed of at least two dimensions of the neural network model; Determining initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed; Performing an offset process on the initial matrix attribute information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension; According to the initial matrix attribute information and the offset matrix attribute information, the feature matrix to be processed is subjected to array conversion processing to obtain a converted feature matrix arranged in a preset array in each dimension; The preset array processing device corresponding to the preset array is used to load and process the converted feature matrix under each dimension.

2. The matrix processing method according to claim 1, It is characterized in that The performing offset processing on the initial matrix attribute information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension includes: Obtaining element position information of matrix elements in the feature matrix to be processed; According to the element position information, the initial matrix attribute information is offset to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

3. The matrix processing method according to claim 2, It is characterized in that The performing offset processing on the initial matrix attribute information according to the element position information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension includes: Determine, according to the element position information, a target information offset device corresponding to the initial matrix attribute information; The target information offset device is used to perform offset processing on the initial matrix attribute information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension.

4. The matrix processing method according to claim 3, It is characterized in that The target information offset device performs offset processing on the initial matrix attribute information to obtain offset matrix attribute information of the feature matrix to be processed in each dimension, including: Obtaining the offset parameter corresponding to the element position information; The target information offset device performs offset processing on the initial matrix attribute information according to the offset parameter to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

5. The matrix processing method according to claim 1, It is characterized in that The method of performing array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information to obtain a converted feature matrix arranged in a preset array in each dimension includes: According to the matrix attribute information composed of the initial matrix attribute information and the offset matrix attribute information, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements; According to the matrix attribute information and the stored matrix elements, the feature matrix to be processed is subjected to array conversion processing to obtain a converted feature matrix arranged in a preset array under each dimension.

6. The matrix processing method according to claim 5, It is characterized in that According to the matrix attribute information formed by the initial matrix attribute information and the offset matrix attribute information, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements, including: According to the dimension of the feature matrix to be processed, the matrix attribute information corresponding to the feature matrix to be processed is grouped and processed to obtain a target matrix attribute information group, wherein the target matrix attribute information group includes target matrix attribute information having a corresponding relationship under different dimensions, wherein the target matrix attribute information belongs to the matrix attribute information; According to the target matrix attribute information group, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

7. The matrix processing method according to claim 6, It is characterized in that According to the target matrix attribute information group, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements, including: According to the target matrix attribute information group, extracting the target matrix elements corresponding to the target matrix attribute information from the matrix elements of the feature matrix to be processed; The target matrix element is stored in a preset storage space corresponding to the target matrix attribute information to obtain a stored matrix element.

8. The matrix processing method according to claim 7, It is characterized in that The step of storing the target matrix element in a preset storage space corresponding to the target matrix attribute information to obtain the stored matrix element includes: If the sub-preset storage spaces in the preset storage spaces corresponding to the target matrix attribute information of different dimensions are different, then within the same preset time, the target matrix elements are respectively stored in the sub-preset storage spaces in the preset storage spaces corresponding to the target matrix attribute information to obtain the stored matrix elements; If the sub-preset storage spaces in the preset storage spaces corresponding to the target matrix attribute information of different dimensions are the same, then the target matrix elements are stored in the sub-preset storage spaces in the preset storage spaces corresponding to the target matrix attribute information at intervals of candidate time to obtain the stored matrix elements.

9. The matrix processing method according to claim 5, It is characterized in that According to the matrix attribute information formed by the initial matrix attribute information and the offset matrix attribute information, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements, including: Detecting storage conflict information of the preset storage space according to the matrix attribute information; According to the storage conflict information, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

10. The matrix processing method according to claim 6, It is characterized in that According to the storage conflict information, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements, including: If the storage conflict information indicates that there is a storage conflict in the matrix element corresponding to the matrix attribute information, then according to a first preset storage strategy, the matrix element in the feature matrix to be processed is stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix element; If the storage conflict information indicates that there is no storage conflict for the matrix elements corresponding to the matrix attribute information, the matrix elements in the feature matrix to be processed are stored in the preset storage space corresponding to the matrix attribute information according to a second preset storage strategy to obtain the stored matrix elements.

11. The matrix processing method according to claim 5, It is characterized in that The step of performing array conversion processing on the feature matrix to be processed according to the matrix attribute information and the stored matrix elements to obtain a converted feature matrix arranged in a preset array under each dimension includes: Classify the matrix attribute information according to the dimensions corresponding to the matrix attribute information to obtain classified matrix attribute information corresponding to each dimension; According to the classified matrix attribute information corresponding to each dimension, extracting the target stored matrix elements corresponding to the classified matrix attribute information from the stored matrix elements; The target stored matrix elements of each dimension are fused respectively to obtain a converted feature matrix arranged in a preset array in each dimension.

12. The matrix processing method according to any one of claims 1 to 11, It is characterized in that The step of determining the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed includes: Determine, according to the vector information of the feature matrix to be processed, a vector field corresponding to the vector information in the feature matrix to be processed; Performing mapping processing on the matrix elements in the vector field to obtain element address information of the matrix elements; According to the element address information, initial matrix attribute information of the feature matrix to be processed in each dimension is generated.

13. A matrix processor, It is characterized in that include: An information generation module, used to obtain a feature matrix to be processed of at least two dimensions of a neural network model; Determine the initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed; perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension; an array conversion module, used to obtain the initial matrix attribute information and the offset matrix attribute information sent by the information generation module, and perform array conversion processing on the feature matrix to be processed according to the initial matrix attribute information and the offset matrix attribute information, so as to obtain a converted feature matrix arranged in a preset array in each dimension; The array processing device is preset to obtain the converted feature matrix sent by the array conversion module, and load the converted feature matrix under each dimension.

14. The matrix processor according to claim 13, It is characterized in that The information generation module includes information determination means and information offset means; The information determination device is used to obtain a to-be-processed feature matrix of at least two dimensions of the neural network model; Determining initial matrix attribute information of the feature matrix to be processed in each dimension according to the vector information of the feature matrix to be processed; The information offset device is used to obtain the initial matrix attribute information sent by the information determination device, and perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

15. The matrix processor according to claim 14, It is characterized in that The information offset device is used for: Obtaining element position information of matrix elements in the feature matrix to be processed; According to the element position information, the initial matrix attribute information is offset to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

16. The matrix processor according to claim 15, It is characterized in that The information offset device includes a plurality of information offset devices; The information determining device is used to determine the target information offset device corresponding to the initial matrix attribute information from the plurality of information offset devices according to the element position information; The target information offset device is used to obtain the initial matrix attribute information sent by the information determination device, and perform offset processing on the initial matrix attribute information to obtain the offset matrix attribute information of the feature matrix to be processed in each dimension.

17. The matrix processor according to claim 13, It is characterized in that The array conversion module is used for: According to the matrix attribute information composed of the initial matrix attribute information and the offset matrix attribute information, the matrix elements in the feature matrix to be processed are stored in a preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements; According to the matrix attribute information and the stored matrix elements, the feature matrix to be processed is subjected to array conversion processing to obtain a converted feature matrix arranged in a preset array under each dimension.

18. The matrix processor according to claim 17, It is characterized in that The array conversion module includes information grouping means and information management means; The information grouping device is used for grouping matrix attribute information corresponding to the feature matrix to be processed according to the dimension of the feature matrix to be processed to obtain a target matrix attribute information group, wherein the target matrix attribute information group includes target matrix attribute information having a corresponding relationship under different dimensions, wherein the target matrix attribute information belongs to the matrix attribute information; The information management device is used to obtain the target matrix attribute information group obtained by the information grouping device, and according to the target matrix attribute information group, store the matrix elements in the feature matrix to be processed in the preset storage space corresponding to the matrix attribute information to obtain the stored matrix elements.

19. The matrix processor according to claim 18, It is characterized in that The information management device is provided with a storage sub-device, and the storage sub-device is used for: According to the target matrix attribute information group, extracting the target matrix elements corresponding to the target matrix attribute information from the matrix elements of the feature matrix to be processed; The target matrix element is stored in a preset storage space corresponding to the target matrix attribute information to obtain a stored matrix element.

20. The matrix processor according to claim 17, It is characterized in that The array conversion module includes an information management device, and the information management device is provided with a classification sub-device and a fusion sub-device; The classification sub-device is used to classify the matrix attribute information according to the dimensions corresponding to the matrix attribute information, and obtain classified matrix attribute information corresponding to each dimension; The fusion sub-device is used to obtain the classified matrix attribute information obtained by the classification sub-device, and according to the classified matrix attribute information corresponding to each dimension, extract the target stored matrix elements corresponding to the classified matrix attribute information from the stored matrix elements, and fuse the target stored matrix elements of each dimension respectively to obtain a converted feature matrix arranged in a preset array under each dimension.