Graph convolutional network training method and apparatus, graph data processing method and apparatus, and device
By using clustering to assign target nodes and source nodes to the optimal cluster during the training process of graph convolutional networks, the problem of low training efficiency caused by the sparsity and irregularity of graph data is solved, and efficient training of graph convolutional networks is achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2026-03-12
AI Technical Summary
During the training of graph convolutional networks, the sparsity and irregularity of graph data lead to frequent repeated memory accesses and cross-cluster communication, which increases the consumption of computing resources and training time, and reduces training efficiency.
By identifying at least two central nodes and constructing at least two clusters during the training process of the graph convolutional network, the target node is assigned to the cluster with the most common source nodes, and the source node is assigned to the cluster with the most edges. The clustering method of maximizing intra-cluster connectivity and minimizing inter-cluster connectivity is adopted to reduce redundant memory access and cross-cluster communication.
With less computational overhead, it improves the training efficiency of graph convolutional networks, reduces memory access and data transfer, lowers the frequency of cross-cluster communication, and optimizes training time.
Smart Images

Figure CN2025118013_12032026_PF_FP_ABST
Abstract
Description
Graph convolutional network training method, graph data processing method, device and equipment
[0001] The present disclosure claims priority to Chinese Patent Application No. 202411258965.0, filed on September 9, 2024, with the Chinese Patent Office, entitled “Graph Convolutional Network Training Method, Graph Data Processing Method, Device and Equipment”, the entire contents of which are incorporated herein by reference. TECHNICAL FIELD
[0002] The present disclosure relates to the technical field of graph data, and in particular to a graph convolutional network training method, a graph data processing method, a device and equipment. BACKGROUND
[0003] A graph convolutional network (GCN) is a deep learning model for processing graph data, and is one of the important models in the field of graph neural networks (GNN). Graph data can also be referred to as graph structure data or a graph. Before applying a graph convolutional network, some graph data as samples are used to train the graph convolutional network.
[0004] When training a graph convolutional network, due to the structure and size of the graph data itself, the model training time consumption is long and the calculation overhead is large, which can cause low training efficiency. SUMMARY
[0005] The present disclosure provides a graph convolutional network training method, a graph data processing method, a device and equipment to improve the training efficiency of training a graph convolutional network.
[0006] In a first aspect, the embodiments of the present disclosure provide a graph convolutional network training method, the graph convolutional network comprising at least one convolutional layer, for processing graph data, the graph data comprising a plurality of nodes and edges between nodes; the method comprising:
[0007] For any convolutional layer, a plurality of target nodes to be processed by the convolutional layer and source nodes of each target node are determined, the target node being a node to be updated with feature information, and the source node of the target node being a node in the neighbor nodes of the target node for updating the target node with feature information;
[0008] At least two center nodes are determined from the plurality of target nodes, any center node corresponding to a cluster, and the remaining target nodes other than the center nodes in the plurality of target nodes are assigned to a cluster having the most common source nodes with the cluster, and each source node is assigned to a cluster having the most edges with the cluster, to obtain at least two clustered clusters.
[0009] In the training process of the graph convolution network, the feature information of the nodes in the clustered cluster corresponding to any convolution layer is read and stored in a cache, and the output result of the convolution layer is obtained according to the feature information stored in the cache.
[0010] In a second aspect, the embodiments of the present disclosure provide a graph data processing method, comprising:
[0011] obtaining graph data to be processed;
[0012] processing the graph data based on a graph convolution network to obtain a corresponding processing result; wherein the graph convolution network is trained by the graph convolution network training method of the first aspect.
[0013] In a third aspect, the embodiments of the present disclosure provide a graph convolution network training device, the graph convolution network comprising at least one convolution layer for processing graph data, the graph data comprising a plurality of nodes and edges between nodes; the device comprising:
[0014] a determination module configured to determine, for any convolution layer, a plurality of target nodes to be processed by the convolution layer and source nodes of each target node, the target node being a node to be updated for feature information, and the source node of the target node being a node in the neighbor nodes of the target node for updating the feature information of the target node;
[0015] an assignment module configured to determine at least two center nodes from the plurality of target nodes, any center node corresponding to a cluster, and assign the remaining target nodes other than the center nodes in the plurality of target nodes to the cluster having the most common source nodes with the cluster, and assign each source node to the cluster having the most edges with the cluster, to obtain at least two clustered clusters;
[0016] a processing module configured to, in the training process of the graph convolution network, read the feature information of the nodes in the clustered cluster corresponding to any convolution layer and store it in a cache, and obtain the output result of the convolution layer according to the feature information stored in the cache.
[0017] In a fourth aspect, the embodiments of the present disclosure provide an electronic device, comprising:
[0018] at least one processor; and
[0019] a memory in communication connection with the at least one processor;
[0020] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method in any of the preceding aspects.
[0021] In a fifth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method in any of the preceding aspects is implemented.
[0022] In a sixth aspect, a computer program product is provided, and the computer program product includes a computer program. When a processor executes the computer program, the method in any of the preceding aspects is implemented.
[0023] The method for training a graph convolutional network, the method for processing graph data, the apparatus, and the device provided in the embodiments of the present disclosure can initialize and construct at least two clusters by determining at least two center nodes in a plurality of target nodes, assign the remaining target nodes in the plurality of target nodes other than the center nodes to a cluster having the most common source nodes with the cluster, and assign each source node to a cluster having the most edges with the cluster, and can cluster at least two clustered clusters. Based on this, the clustering manner of maximizing intra-cluster connection and minimizing inter-cluster connection is used for clustering the target nodes and the source nodes, respectively, so that the target nodes in the same cluster have the most common source nodes, and the target nodes in different clusters have the least common source nodes. In this way, when the target nodes in the same clustered cluster are updated, the feature information of the common source nodes can be maximally reused, that is, the feature information stored in the cache can be more frequently called, the number of times of reading the feature information from the memory and writing the feature information into the cache can be reduced, repeated memory access is reduced, the data transmission amount is reduced, and the frequency of cross-cluster communication is reduced. The method can quickly obtain a plurality of optimally allocated clusters with less computational overhead, so that the graph convolutional network can avoid repeated memory access and cross-cluster communication as much as possible during the training process, efficiently output results, and thus improve the training efficiency of the graph convolutional network. BRIEF DESCRIPTION OF DRAWINGS
[0024] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure together with the specification.
[0025] FIG. 1 is a schematic diagram of a graph convolutional network processing graph data according to an embodiment of the present disclosure;
[0026] FIG. 2 is a flowchart of a method for training a graph convolutional network according to an embodiment of the present disclosure;
[0027] FIG. 3 is a schematic diagram of training efficiency comparison according to an embodiment of the present disclosure;
[0028] FIG. 4 is a schematic diagram of training efficiency comparison according to another embodiment of the present disclosure;
[0029] FIG. 5 is a schematic diagram of an adjacency matrix according to an embodiment of the present disclosure;
[0030] FIG. 6 is a schematic diagram of full batch training according to an embodiment of the present disclosure;
[0031] FIG. 7 is a schematic diagram of non-full batch training according to an embodiment of the present disclosure;
[0032] FIG. 8 is a schematic diagram of non-full batch training according to another embodiment of the present disclosure;
[0033] FIG. 9 is a schematic diagram of data flow of multi-PE parallel computing according to an embodiment of the present disclosure;
[0034] FIG. 10 is a schematic diagram of data flow of tile memory access according to an embodiment of the present disclosure;
[0035] FIG. 11 is a schematic diagram of tile conflict according to an embodiment of the present disclosure;
[0036] FIG. 12 is a schematic diagram of tile conflict elimination mechanism according to an embodiment of the present disclosure;
[0037] FIG. 13 is a schematic diagram of tile conflict elimination mechanism according to another embodiment of the present disclosure;
[0038] FIG. 14 is a schematic diagram of tile conflict elimination mechanism according to another embodiment of the present disclosure;
[0039] FIG. 15 is a schematic diagram of offline rearrangement according to an embodiment of the present disclosure;
[0040] FIG. 16 is a schematic diagram of rearrangement hardware device connection according to an embodiment of the present disclosure;
[0041] FIG. 17 is a schematic diagram of a graph data processing method according to an embodiment of the present disclosure;
[0042] FIG. 18 is a schematic diagram of an electronic device according to an embodiment of the present disclosure.
[0043] The above-described figures have shown specific embodiments of the present disclosure, which will be described in more detail hereinafter. These figures and written descriptions are not intended to limit the scope of the present disclosure concept in any way, but to illustrate the present disclosure concept to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0044] The exemplary embodiments will be described in detail below with reference to the accompanying drawings. The embodiments described in the following exemplary embodiments do not represent all the embodiments consistent with the present disclosure.
[0045] It should be noted that the user information (including but not limited to user equipment information, user attribute information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards, and provide corresponding operation portal for user to choose authorization or refusal.
[0046] The graph data includes nodes and edges, where the nodes represent objects and the edges represent the relationships between them. The goal of GCN is to learn the complex relationships between nodes in a graph and perform tasks such as node classification and node representation learning on the graph. The design inspiration of GCN comes from the structure of the graph and the local neighborhood information, which enables it to effectively capture the complex relationships between nodes in the graph. The basic idea of GCN is to learn the information in the graph by iteratively updating the representation of the nodes. Each node aggregates the information of its neighbor nodes to update its own representation, where the neighbor nodes of a node are other nodes directly connected to the node through edges. If there is an edge between two nodes, the two nodes are each other's neighbor nodes, and a node and all its neighbor nodes form the neighborhood of the node. The process of aggregating neighbor node information for information transmission can be implemented through a hierarchical neural network structure, where each layer locally updates the representation of the nodes. The representation of the node or the information of the node can be understood as information used to represent the features of the node, such as the feature information of the node.
[0047] The graph convolution layer in GCN performs convolution operations in the neighborhood of each node, thereby integrating the information of the neighbor nodes. The graph convolution layer in GCN can also be referred to as a convolution layer. The core operations of GCN include aggregating neighbor node information and updating node representation. This enables GCN to capture semantic and structural information of nodes in the structure of graph data, making it suitable for various fields such as social networks, molecular structures, recommendation systems, etc. In general, graph convolutional networks are a powerful deep learning model suitable for processing graph-structured data, which can effectively solve many practical problems by learning the relationships and local structure information between nodes.
[0048] FIG. 1 is a schematic diagram of processing graph data by a graph convolutional network according to an embodiment of the present disclosure. As shown in FIG. 1, each circle represents a node, and the line segment connecting two circles represents an edge connecting two nodes. For example, in the graph data of a social network, a node can represent a social member in the social network, and an edge between two nodes can represent a social relationship between the two social members. For another example, in the graph data of a recommendation system for commodity recommendation, a node can represent a user or a commodity in the recommendation system, and an edge between two nodes can represent an association between users or between commodities.
[0049] As shown in the Aggregation stage in FIG. 1, the black nodes represent nodes that need to be updated, i.e., destination nodes, and the other nodes directly connected to the destination nodes are neighbor nodes of the destination nodes. The information of the destination nodes can be updated by aggregating the information of the neighbor nodes, i.e., a convolution operation is implemented. The hidden layers are network layers for processing the graph data in the graph convolutional network, and the hidden layers include linear transformation layers, normalization layers, and pooling layers, etc. The graph convolutional network can include one or more hidden layers. The information of the nodes after the convolution operation is combined and processed by a linear rectifier function (relu), and the processed graph data is input into the hidden layers for processing. The graph data output by the hidden layers is activated to solve a specific task module for solving an actual problem, and the graph data can output an output result after being processed by the graph convolutional network, which is used to solve a problem in an actual application scenario.
[0050] For example, the graph data has sparsity and irregularity, which are determined by the nature of the graph structure. The graph data is usually sparse, which can be understood as that the number of actual existing edges in the graph is much less than the number of edges if there are edges between all nodes in the graph. In a large-scale network, there are no edges between most nodes, so the adjacency matrix of the graph is usually a sparse matrix, which makes it necessary to consider how to efficiently represent and operate the sparse structure when storing and processing the graph data to avoid wasting storage and computing resources. The adjacency matrix can be a matrix for representing the edges between the nodes in the graph data, for example, the rows and columns of the adjacency matrix represent the nodes in turn, and the element value at the row and column corresponding to two nodes is zero if there is no edge between the two nodes, and the element value at the row and column corresponding to two nodes is a non-zero value if there is an edge between the two nodes. The element value is zero, i.e., the element is a zero element, and the element value is a non-zero value, i.e., the element is a non-zero element.
[0051] The irregularity of the graph data is reflected in the fact that the connection between nodes can be arbitrary, unlike a regular grid structure. The degrees of different nodes (i.e., the number of edges of a node) can vary greatly, and some nodes can have only a few neighbor nodes, and thus have a small degree, while some nodes can have a large number of neighbor nodes, and thus have a large degree. Since the connection between nodes in the graph data is irregular, the structure of the graph data is irregular. Since the structure of most graph data is irregular, it is not possible to simply rely on regular graphs to design algorithms or models for processing arbitrary graph data.
[0052] Due to the complex connection between nodes and the sparsity of edges, the graph data can have irregularity and sparsity. Therefore, during the training of the graph convolution network, repeated memory access and cross-cluster communication can occur, which can increase the consumption of computing resources and the time required for training, thereby reducing the training efficiency of the graph convolution network.
[0053] In the graph convolution network, the information update of a node depends on the information of its neighbor nodes. This means that when calculating the new information of each node, the information of at least part of the neighbor nodes of the node needs to be accessed. Due to the sparsity and irregularity of the graph data, some nodes can have many neighbor nodes, while some nodes can have only a few neighbor nodes. This uneven distribution of neighbor nodes can lead to a large number of repeated memory access situations.
[0054] For example, when updating the information of a node, multiple target nodes are usually updated in the same batch. When updating, the information of the neighbor nodes of each target node is accessed from the memory and cached in the cache area for update operation. If multiple target nodes in the same batch have some common neighbor nodes, the information of the common neighbor nodes can be directly called in the cache area to update multiple target nodes during the update operation; if the target nodes have no common neighbor nodes, the neighbor nodes in the cache cannot be reused, and thus unnecessary repeated memory access can occur during the next parallel update. During repeated memory access, memory access is frequent, and the cache area also needs to frequently delete and store newly read data, which can increase the computational resource overhead, prolong the operation time, and reduce the efficiency of the graph convolution network during training. Therefore, if multiple target nodes in the same batch can share more node information, the frequency of memory access can be reduced, the computational resource overhead can be reduced, the training time can be shortened, and thus the training efficiency can be improved.
[0055] The data amount of some graph data can be large, and processing large-scale graph data needs to be completed in a distributed computing environment. In the distributed environment, the calculation of the graph convolution network usually needs to be performed across multiple computing nodes. One computing node can be understood as one computing device in the distributed environment, and a single computing node generally cannot accommodate the entire graph data. Due to the distributed data operation mode, the graph data needs to be distributed and run on multiple computing nodes, so that each node only processes a part of the graph. However, due to the sparsity and irregularity of the graph, when the target node is updated, some or all of the neighbor nodes of the target node can be on other computing nodes, and therefore, when the graph convolution is calculated, the information of the neighbor nodes needs to be obtained from other computing nodes, that is, cross-cluster communication occurs. The overhead of cross-cluster communication is usually larger than that of memory access, and therefore, frequent cross-cluster communication can cause a bottleneck in network bandwidth, increase the calculation delay, and reduce the training efficiency. It can be seen that reasonable allocation of graph data can make the connection relationship between nodes on the same computing node close and make the nodes on different computing nodes have as few connections as possible, so as to reduce the frequency of cross-cluster communication, and in turn reduce the calculation overhead and time consumption, thereby improving the training efficiency.
[0056] It is considered that if the graph partitioning (METIS) algorithm is used to split the graph data, although the entire graph can be split into multiple graph blocks, the METIS algorithm needs to traverse the entire graph multiple times, and the calculation overhead is large, which can further exacerbate the reduction of training efficiency. Specifically, when the METIS algorithm partitions the graph, it first simplifies the graph by merging some nodes in the graph data multiple times, so that the original graph is simplified into a small-scale graph with a small number of nodes, and then the small-scale graph needs to be divided into graph blocks. After multiple graph blocks are divided, the size of each graph block needs to be gradually enlarged, and the nodes are restored to the nodes before simplification. In the entire process, the nodes and edges in the entire graph data need to be read multiple times, resulting in a large calculation overhead. Therefore, if the graph partitioning is performed based on the existing method, it is difficult to meet the demand for efficient training.
[0057] Therefore, in order to effectively improve the training efficiency of the graph convolutional network, the embodiment of the present disclosure provides a graph convolutional network training method. For any convolutional layer of the graph convolutional network, at least two center nodes are determined in a plurality of target nodes, at least two clusters are initialized and constructed, the remaining target nodes in the plurality of target nodes except the center nodes are allocated to the cluster with the most common source nodes, and each source node is allocated to the cluster with the most edges. At least two clustered clusters can be obtained. Based on this, for the target nodes and the nodes in the neighbor nodes of the target nodes used for updating the feature information of the target nodes, that is, each source node, the clustering method is used, and the number of common source nodes between the target nodes and the clusters is calculated. Each target node can be quickly allocated to a cluster, so that each target node in the same cluster has the most common source nodes, which helps to maximize the sharing of the feature information of the source nodes when updating the target nodes. In addition, according to the number of edges between the source nodes and the clusters, each source node can be quickly allocated to the cluster with the most edges, which minimizes the connection between the clusters and reduces the frequency of cross-cluster communication. Therefore, through this method, a plurality of optimized clusters can be quickly obtained with less calculation overhead. In the training process of the graph convolutional network, the feature information of the nodes in the clustered clusters corresponding to the convolutional layer is read and stored in the cache according to the clustered clusters. When updating the target nodes according to the feature information stored in the cache, the repeated memory access can be reduced, the data transmission amount of the electronic device can be reduced, the cross-cluster communication can be reduced, and the output result of the convolutional layer can be quickly obtained. Therefore, the training efficiency of the graph convolutional network can be improved.
[0058] FIG. 2 is a flowchart of a graph convolutional network training method provided by an embodiment of the present disclosure. The method of the present embodiment can be implemented on an electronic device with corresponding information processing functions, such as a computer, a server, or a server cluster. When the electronic device implements the method, it can be implemented on the cloud, deployed locally, implemented on a client, implemented on an Internet of Things (IOT) device, etc. The graph convolutional network includes at least one convolutional layer for processing graph data, and the graph data includes a plurality of nodes and edges between the nodes, as shown in FIG. 2. The method can include the following steps:
[0059] In step 201, for any convolutional layer, a plurality of target nodes to be processed by the convolutional layer and source nodes of each target node are determined. The target node is a node to be updated for feature information, and the source node of the target node is a node in the neighbor nodes of the target node used for updating the feature information of the target node.
[0060] Exemplarily, the convolutional layer can be a network layer performing convolution operation, the graph convolutional network can include one or more convolutional layers, each convolutional layer updates the feature information of a node through convolution operation, and the process of the convolution operation can also be understood as the process of aggregating the feature information. If multiple convolutional layers are included, the network parameters of each convolutional layer can be the same or different, and the target nodes corresponding to each convolutional layer can be the same or different.
[0061] The feature information of a node can be understood as information used to describe the attributes, properties or other related features of the node. The feature information of a node can be in various forms, such as numbers, vectors or matrices, etc. The features described by the feature information can depend on the scenario or field of the source of the graph data. For example, the graph data from a user social network, the node represents a user, and the feature information of the node can be a feature matrix used to describe the information of the user's age, gender, interest, and geographic location, etc.
[0062] Exemplarily, the graph data includes multiple nodes, and for any convolutional layer, the nodes to be updated by the convolutional layer through convolution operation to update the feature information can be understood as the target nodes in the convolutional layer. In some convolutional layers, all nodes in the graph data can be target nodes in the convolutional layer; in some convolutional layers, part of the nodes in the graph data are target nodes in the convolutional layer. All or part of the nodes as target nodes can be set according to the actual application scenario of the convolutional layer. For example, in some scenarios, it is too costly to consider all nodes as target nodes, therefore, all nodes can be trained in batches, each batch contains a part of nodes as target nodes for training, and the sum of the target nodes of all batches is all nodes in the graph data.
[0063] The nodes in the neighbor nodes of the target node used to update the feature information of the target node are source nodes, which can be understood as the neighbor nodes sampled by the target node in the aggregation process. When the convolutional layer aggregates the feature information of the neighbor nodes to update the feature information of the target node, it can be updated by aggregating the feature information of all neighbor nodes, or it can be updated by aggregating the feature information of part of the neighbor nodes, which can depend on the setting of the convolutional layer. For example, if the length of the edge between nodes represents the strength of the association relationship between nodes, the longer the edge, the weaker the association relationship, and the shorter the edge, the stronger the association relationship; assuming that the edge length is used as the basis for sampling each neighbor node, the neighbor nodes with edge length less than a preset edge length can be determined as source nodes.
[0064] Exemplarily, after determining the plurality of target nodes to be processed, the source nodes of the target nodes can be determined according to the sampling strategy of the target nodes. For example, for any target node to be processed, if the sampling strategy is full sampling, all neighbor nodes of the target node can be determined as the source nodes; if the sampling strategy is partial sampling with a preset proportion, a preset proportion of the neighbor nodes of the target node can be randomly determined as the source nodes; or according to at least one of the conditions of the sorting of the neighbor nodes based on the feature information, the sorting of the edges between the neighbor nodes and the target node, etc., a preset proportion or a preset number of the source nodes of the target node can be determined. For example, the difference between the feature information of each neighbor node and the feature information of the target node is calculated, and a preset number of neighbor nodes with larger difference values are determined as the source nodes of the target node according to the size of the difference values. For another example, the edges between the neighbor nodes and the target node are sorted in ascending order according to the length of the edges, and a preset number of neighbor nodes in the front of the sorting are determined as the source nodes of the target node.
[0065] It can be understood that, due to different conditions such as the way of determining the target nodes, the neighbor node sampling strategy, etc., the time and computing resources consumed in determining the plurality of target nodes to be processed and the source nodes of the target nodes are different, which may cause deviation in the comparison and evaluation of the training efficiency. Therefore, the consumption factors can be aligned first to evaluate the efficiency of the training more accurately.
[0066] In step 202, at least two center nodes are determined from the plurality of target nodes, any center node corresponds to a cluster, the remaining target nodes except the center nodes in the plurality of target nodes are distributed to the cluster with the most common source nodes, and each source node is distributed to the cluster with the most edges, to obtain at least two clustered clusters.
[0067] The center node can be understood as the clustering center of the cluster, and each cluster corresponds to a clustering center, i.e., each cluster corresponds to a center node. The center node can also be understood as the first target node added to the cluster after the cluster is initially established.
[0068] Exemplarily, when at least two center nodes are determined from the plurality of target nodes, a preset or random number of at least two target nodes can be randomly determined as at least two center nodes from all target nodes. In some application scenarios, at least two center nodes can be determined from all target nodes according to a preset strategy. For example, the preset strategy is to divide the graph into at least two local regions according to the overall structure of the graph, and obtain at least two local regions; for any local region, one target node in the local region is determined as a center node; based on this, at least two center nodes can be determined.
[0069] The rest of the target nodes in the plurality of target nodes except the center node are target nodes in the plurality of target nodes to be processed which are not determined as the center node. For each of the rest of the target nodes in the plurality of target nodes except the center node, the number of common source nodes of the target node and each cluster can be determined first, then the numbers are compared, and the target node is assigned to the cluster corresponding to the largest number. The common source node can be understood as the source node that is the same in all source nodes of all target nodes in the cluster and all source nodes of the target node to be assigned.
[0070] For example, there are three clusters, cluster 1, cluster 2 and cluster 3, one target node to be assigned is target node a, and the source nodes of target node a are node b, node c and node d; all source nodes of all target nodes in cluster 1 are node b, node c, node d and node e, so the common source nodes of target node a and cluster 1 are node b, node c and node d, and the number of common source nodes of target node a and cluster 1 is 3; all source nodes of all target nodes in cluster 2 are node b, node c, node e, node f and node g, so the common source nodes of target node a and cluster 2 are node b and node c, and the number of common source nodes of target node a and cluster 2 is 2; all source nodes of all target nodes in cluster 3 are node d, node e and node h, so the common source nodes of target node a and cluster 3 are node d, and the number of common source nodes of target node a and cluster 3 is 1; based on this, target node a can be assigned to cluster 1 which has the most common source nodes with the cluster.
[0071] After the rest of the target nodes in the plurality of target nodes except the center node are assigned to the corresponding clusters, each cluster has at least one target node including the center node, and each target node is connected to one or more source nodes. For any one source node and any one cluster, the edge of the source node and the cluster can be understood as all edges of the source node and all target nodes in the cluster. For any one source node, when the source node is assigned to the cluster with the most edges, the number of edges of the source node and the cluster can be determined first, then the numbers are compared, and the source node is assigned to the cluster with the most edges.
[0072] For example, after the rest of the target nodes in the plurality of target nodes except the center node are assigned to cluster 1, cluster 2 and cluster 3, the number of target nodes in each cluster may increase, and for a source node x, the source node x may have edges connected to multiple target nodes in a cluster. Assuming that the source node x has edges connected to 5 target nodes in cluster 1, the source node x has 5 edges with cluster 1; the source node x has edges connected to 3 target nodes in cluster 2, the source node x has 3 edges with cluster 2; the source node x has no edge connected to the target node in cluster 3, the source node x has 0 edge with cluster 3; based on this, the source node x can be assigned to cluster 1 with the most edges.
[0073] Through the above assignment of the rest of the target nodes in the plurality of target nodes except the center node and each source node, at least two clusters after clustering can be obtained, and each cluster obtained has more common source nodes between the target nodes in the cluster. In the convolution operation, the feature information of the shared source nodes can be maximized in the on-chip cache area, and the number of frequent accesses in the memory can be reduced; the source node is assigned to the cluster with the most edges, and the source node is closely connected to the target nodes in the assigned cluster and sparsely connected to the target nodes in other clusters, so the connection between clusters is less, the frequency of cross-cluster communication can be reduced, and the cross-cluster communication overhead and the training time of the graph convolutional network can be saved.
[0074] In step 203, in the training process of the graph convolutional network, the feature information of the nodes in the clustered cluster corresponding to any convolutional layer is read and stored in the cache according to the clustered cluster, and the output result of the convolutional layer is obtained according to the feature information stored in the cache.
[0075] For example, through the above steps 201 and 202, the target nodes and source nodes in the graph data corresponding to the convolutional layer can be clustered to obtain at least two clusters corresponding to the convolutional layer. When the convolutional layer performs convolution operation, the feature information of the nodes in each clustered cluster can be read and stored in the cache in batches according to the clustered cluster, and the feature information of the target nodes in the cluster is updated according to the feature information stored in the cache. When the feature information of the target nodes in each cluster is updated, the convolutional layer can output the output result of the layer.
[0076] It can be understood that the feature information of all nodes in the graph data can be pre-stored in a memory, a hard disk or other storage medium of the electronic device. After obtaining the clustered cluster, the feature information of all target nodes and all source nodes in the same clustered cluster can be read from the storage medium and stored in a cache, such as an on-chip cache area of a processor of the electronic device. Since the same clustered cluster has the most common source nodes, storing the feature information of each node in the same clustered cluster in the cache can reduce the reading and caching of unnecessary feature information, avoid the need to access the memory again for reading and writing to the cache when the needed feature information is not in the cache, reduce repeated memory access, reduce the amount of data transmission, and can reduce the computational complexity of the electronic device and improve the training efficiency.
[0077] FIG. 3 is a training efficiency comparison diagram provided by an embodiment of the present disclosure, and FIG. 4 is another training efficiency comparison diagram provided by an embodiment of the present disclosure. In order to more intuitively reflect the target nodes and the source nodes, in FIGS. 3 and 4, the arrow direction of the edge is the direction in which the source node points to the target node, that is, the node pointed by the arrow is the target node, and the node at the source end of the arrow is the source node. It should be noted that the nodes in the dashed circle represent unsampled neighbor nodes.
[0078] As shown in FIG. 3, if the target nodes v1, v2, v3 and v4 are not clustered according to the above steps of the present embodiment, v1 and v2 can be taken as a graph block A1.1 to update the feature information in the same batch, and v3 and v4 can be taken as another graph block A2.1 to update the feature information in the same batch. It can be known that when updating the graph block A1.1, the source nodes v5 to v8 of v1 and the source nodes v8 to v11 of v2 need to be accessed and cached, wherein only the feature information of the source node v8 can be reused twice in the on-chip cache area, and the feature information of the other source nodes is only used once. Similarly, when updating the graph block A2.1, the source nodes v9 to v12 of v3 and the source nodes v6 to v9 of v4 need to be accessed and cached, wherein only the feature information of the source node v9 can be reused twice in the on-chip cache area, and the feature information of the other source nodes is only used once. Based on the above situation, it can be seen that the memory needs to be accessed multiple times during updating.
[0079] As shown in FIG. 4, if the target nodes v1, v2, v3 and v4 are clustered according to the above steps of the embodiment, specifically, from the target nodes v1, v2, v3 and v4, the target node v1 can be determined as the center node corresponding to cluster 1, the target node v2 can be determined as the center node corresponding to cluster 2, and then the target node v3 and the target node v4 can be allocated to the cluster having the most common source nodes with the cluster. The cluster 1 includes the target node v1, and the source nodes of the target node v1 are v5, v6, v7 and v8, so the source nodes of the cluster 1 are v5, v6, v7 and v8. The cluster 2 includes the target node v2, and the source nodes of the target node v2 are v8, v9, v10 and v11, so the source nodes of the cluster 2 are v8, v9, v10 and v11. The source nodes of the target node v3 are v9, v10, v11 and v12, the target node v3 has no common source node with the cluster 1, and the common source nodes of the target node v3 with the cluster 2 are the source nodes v9, v10 and v11, which have 3 common source nodes, so the target node v3 can be allocated to the cluster 2. The source nodes of the target node v4 are v6, v7, v8 and v9, the common source nodes of the target node v4 with the cluster 1 are the source nodes v6, v7 and v8, which have 3 common source nodes, and the common source nodes of the target node v4 with the cluster 2 are the source nodes v8 and v9, which have 2 common source nodes, so the target node v4 can be allocated to the cluster 1.
[0080] The v1 and v4 having the most common source nodes are clustered into one cluster, which is represented by the block A1.1, and the feature information of v1 and v4 will be updated in the same batch during updating; the v2 and v3 having the most common source nodes are clustered into one cluster, which is represented by the block A2.1, and the feature information of v2 and v3 will be updated in the same batch during updating. It can be known that, when the block A1.1 is updated, only the source nodes v5 to v8 of v1 and the source nodes v6 to v9 of v4 need to be accessed and cached, and the feature information of the source nodes v6, v7 and v8 can be reused twice in the on-chip cache area, so the number of source nodes that can be shared is obviously increased; similarly, when the block A2.1 is updated, the source nodes v8 to v11 of v2 and the source nodes v9 to v12 of v3 need to be accessed and cached, and the feature information of the source nodes v9, v10 and v11 can be reused twice in the on-chip cache area, so the number of source nodes that can be shared is also obviously increased. Based on the above situation, it can be seen that, after the clusters are obtained by using the above method, the number of feature information that needs to be read during each batch update can be reduced by reading the feature information of the nodes in the clustered clusters, so the number of repeated memory access can be reduced, the computing resource overhead and the training time can be saved.
[0081] In FIG. 3 and FIG. 4, the A matrix can represent the adjacency matrix of the target nodes and the source nodes, and the B matrix can represent the feature information matrix of the source nodes. Through matrix operation of the A matrix and the B matrix, the operation result 0 can be obtained, and the block A1.1 corresponds to the result 01.1; the block A2.1 corresponds to the result 02.1. Through the training of the graph convolutional network by the method, the GCN training can be performed according to the cluster, the repeated access to the source nodes v6, v7, v10 and v11 is merged, the target nodes sharing the source nodes are distributed into the same cluster, thereby optimizing the data locality, reducing the memory access redundancy, and improving the training efficiency.
[0082] Exemplarily, in the environment of distributed computing, one computing node can be responsible for the update of the target nodes in one or more clusters. When one computing node is responsible for the update of the target nodes in multiple clusters, the multiple clusters can be the multiple clusters with relatively close connection relationship between the clusters. For example, the multiple clusters with more edges between the clusters are the multiple clusters with relatively close connection relationship.
[0083] The method for training the graph convolutional network provided in the embodiment can initialize and construct at least two clusters by determining at least two center nodes in the multiple target nodes, distribute the remaining target nodes in the multiple target nodes except the center nodes into the cluster with the most common source nodes with the cluster, and distribute each source node into the cluster with the most edges with the cluster, so as to cluster at least two clustered clusters. Based on this, the target nodes and the source nodes are clustered by using the clustering mode of maximizing the intra-cluster connection and minimizing the inter-cluster connection, so that each target node in the same cluster has the most common source node, and different clusters have the least common source node. In this way, when the target nodes in the same clustered cluster are updated, the feature information of the common source node can be maximally reused, that is, the feature information stored in the cache can be more repeatedly called, the number of reading the feature information from the memory and writing the feature information into the cache can be reduced, that is, the repeated memory access is reduced, the data transmission amount is reduced, and the frequency of cross-cluster communication is reduced. The method can quickly obtain multiple optimal distributed clusters with less computing overhead, so that the graph convolutional network can avoid repeated memory access and cross-cluster communication as much as possible during the training process, efficiently output the result, and thus improve the training efficiency of the trained graph convolutional network.
[0084] Since only the number of common source nodes and the number of edges of the source nodes and each cluster need to be calculated when clustering, the clustering method in the embodiment is a lightweight two-stage dynamic clustering mechanism method compared with the existing graph partitioning method such as graph partitioning. The lightweight means that the computational overhead is small. Under the premise of small computational overhead, by maximizing the intra-cluster connection and minimizing the inter-cluster connection, the target nodes sharing more source nodes are allocated to the same cluster, efficient intra-cluster processing is realized, memory access redundancy and cross-cluster communication are reduced, and the efficiency and data locality of graph convolution network training are significantly improved. The mechanism is not only suitable for mini-batch GCN training acceleration, but also suitable for full-batch GCN training acceleration, wherein the mini-batch means non-full batch.
[0085] In some embodiments, when the remaining target nodes except the center nodes in the plurality of target nodes are allocated to the cluster having the most common source nodes with the cluster, the allocation can be realized by the following method:
[0086] At least one target node is determined from the remaining target nodes except the center nodes in the plurality of target nodes. For any target node in the at least one target node, the neighbor mask of the target node is compared with the cluster mask of each cluster to determine the cluster having the most common source nodes with the target node, and the target node is allocated to the determined cluster. The neighbor mask is used to represent the source nodes of the target node, and the cluster mask is used to represent the source nodes of the target node in the cluster. The cluster mask of the determined cluster is updated according to the neighbor mask of the target node. In the case that there are target nodes in the remaining target nodes except the center nodes in the plurality of target nodes which are not allocated to the cluster, the target nodes not allocated to the cluster are allocated in the same way as the above step of comparing the neighbor mask of the target node with the cluster mask of each cluster, until the remaining target nodes except the center nodes in the plurality of target nodes are all allocated to the cluster.
[0087] Exemplarily, after determining each center node, i.e., determining the cluster corresponding to each center node, these clusters are initial clusters, and the other target nodes of the non-center nodes, i.e., the remaining target nodes except the center nodes in the plurality of target nodes, are allocated to each cluster through one or more allocations.
[0088] For example, if all the target nodes except the center node are determined at one time, all the target nodes can be allocated to the clusters at one time; if one target node is determined at one time, multiple times of allocation can be needed to allocate all the target nodes to the clusters. When multiple times of allocation are needed, at least one target node can be determined randomly from the target nodes except the center node.
[0089] The neighbor mask can be a mask used to represent the source nodes of the target node, and can be in various forms, for example, the neighbor mask can be represented by an ordered number list or by a set. The cluster mask can be a mask used to represent the source nodes of the target nodes in a cluster, and the representation of the cluster mask can be the same as that of the neighbor mask.
[0090] For example, if one target node is determined from the target nodes except the center node, the target node is v1, and the neighbor mask of v1 is (v2, v3, v4), which means the source nodes of v1 are v2, v3 and v4; the cluster mask of cluster 1 is (v2, v4, v5, v6), which means the source nodes of all the target nodes in cluster 1 are v2, v4, v5 and v6; and the cluster mask of cluster 2 is (v2, v6, v7, v8), which means the source nodes of all the target nodes in cluster 2 are v2, v6, v7 and v8. By comparing the neighbor mask (v2, v3, v4) with the cluster masks (v2, v4, v5, v6) and (v2, v6, v7, v8), it can be determined that v1 has two common source nodes with cluster 1 and one common source node with cluster 2, and v1 can be allocated to cluster 1.
[0091] Since a new target node is allocated to a cluster, the cluster mask of the cluster needs to be updated. When the cluster mask of the determined cluster is updated according to the neighbor mask of the target node, the neighbor mask can be combined with the cluster mask, and the repeated source nodes can be combined, so as to obtain the updated cluster mask.
[0092] For example, the neighbor mask (v2, v3, v4) of the target node v1 is merged with the cluster mask (v2, v4, v5, v6) of cluster 1 to obtain (v2, v3, v4, v2, v4, v5, v6), and after merging the duplicate source nodes v2 and v4, the updated cluster mask of cluster 1 is (v2, v3, v4, v5, v6). The updated cluster mask is compared with the subsequently determined target node to perform cluster allocation for the unallocated target node.
[0093] In the embodiment, by determining at least one target node from the remaining target nodes except the center node among the plurality of target nodes, the allocation flexibility can be improved by allocating the target nodes not allocated to the cluster one or more times. Since the neighbor mask and the cluster mask can simplify the representation of the source node, by comparing the neighbor mask of the target node with the cluster mask of each cluster, the cluster with the most common source node with the target node can be quickly determined with less calculation, and the speed of allocation is improved. Since some clusters are allocated with new target nodes, the cluster mask of the determined cluster can be updated according to the neighbor mask of the target node, so that the cluster mask can be dynamically updated and accurately represent the source nodes of all target nodes in the current cluster; in the case that there are target nodes not allocated to the cluster among the remaining target nodes except the center node among the plurality of target nodes, the remaining target nodes except the center node among the plurality of target nodes can be allocated to the cluster by repeatedly performing the previous allocation action.
[0094] In some embodiments, the neighbor mask and the cluster mask are both represented by a binary vector, and the binary vector is a vector with zero or non-zero value elements; when the neighbor mask of the target node is compared with the cluster mask of each cluster to determine the cluster with the most common source node with the target node, the comparison can be realized by the following way:
[0095] For any cluster, the neighbor mask of the target node is logically ORed with the cluster mask of the cluster, and the result of the logical OR operation is logically XORed with the cluster mask of the cluster to obtain a comparison result; according to the comparison results of the target node and each cluster, the cluster corresponding to the comparison result with the least number of non-zero value elements in each comparison result is determined as the cluster with the most common source node with the target node.
[0096] For example, the element value in the binary vector is zero or non-zero value, that is, the element in the binary vector is zero element or non-zero element. The non-zero value can be 1 or other numerical value, wherein zero can represent non or false, and the non-zero value can represent yes or true. The neighbor mask and the cluster mask represented by the binary vector can be logically operated to realize more convenient target node allocation.
[0097] The order of each element in the binary vector can correspond to the order of each source node. For example, the 8 nodes v1-v8 are arranged in order from v1 to v8, and the order corresponds to each element in the binary vector in turn. Taking 1 as the non-zero value as an example, the neighbor mask (v2, v3, v4) of the target node v1 can be represented as (0, 1, 1, 1, 0, 0, 0, 0), where the value of the first element is 0, indicating that node v1 is not a source node of the target node v1, i.e., node v1 is not its own source node; the value of the second element is 1, indicating that node v2 is a source node of the target node v1; the value of the third element is 1, indicating that node v3 is a source node of the target node v1, and so on, which will not be repeated.
[0098] Similarly, the cluster mask (v2, v4, v5, v6) of cluster 1 can be represented as (0, 1, 0, 1, 1, 1, 0, 0), where the value of the first element is 0, indicating that node v1 is not a source node of the target node in cluster 1; the value of the second element is 1, indicating that node v2 is a source node of the target node in cluster 1; the value of the third element is 0, indicating that node v3 is not a source node of the target node in cluster 1, and so on, which will not be repeated. The cluster mask (v2, v6, v7, v8) of cluster 2 can be represented as (0, 1, 0, 0, 0, 1, 1, 1).
[0099] The neighbor mask of the target node is logically ORed with the cluster mask of the cluster, and the result of the logical OR operation is logically XORed with the cluster mask of the cluster to obtain a comparison result. The process of logical operation can be represented as md,c=(md∨mc)⊕mc, for example, where md represents the neighbor mask of the target node, mc represents the cluster mask of the cluster, ∨ represents the logical OR operation, ⊕ represents the logical XOR operation, and md,c represents the comparison result obtained by logically operating the neighbor mask of the target node and the cluster mask of the cluster. After obtaining the comparison results with each cluster, the cluster corresponding to the comparison result with the least number of non-zero elements in each comparison result can be determined as the cluster with the most common source nodes with the target node according to the comparison results of the target node and each cluster. It can be understood that the logical OR operation can merge the range of source nodes of the target node and the cluster, and when the XOR operation is performed with the cluster mask, the source nodes in the merged range that are different from the source nodes of the cluster are filtered out. The cluster corresponding to the comparison result with the least number of non-zero elements in the comparison result is recorded as the cluster with the most common source nodes with the target node, so that the cluster to which the target node should be assigned can be quickly obtained through simple logical operation. Compared with the method of repeatedly traversing the entire graph data and performing graph reduction and graph expansion in graph partitioning, the computational overhead of logical operation is significantly less.
[0100] For example, the neighbor mask (0, 1, 1, 1, 0, 0, 0, 0) of the target node v1 is logically ORed with the cluster mask (0, 1, 0, 1, 1, 1, 0, 0) of the cluster 1, that is, the elements in the same order are logically ORed, (0, 1, 1, 1, 0, 0, 0, 0) ∨ (0, 1, 0, 1, 1, 1, 0, 0) = (0 ∨ 0, 1 ∨ 1, 1 ∨ 0, 1 ∨ 1, 0 ∨ 1, 0 ∨ 1, 0 ∨ 0, 0 ∨ 0) = (0, 1, 1, 1, 1, 1, 0, 0). The result is logically XORed with the cluster mask (0, 1, 0, 1, 1, 1, 0, 0) of the cluster 1, that is, (0, 1, 1, 1, 1, 1, 0, 0) ⊕ (0, 1, 0, 1, 1, 1, 0, 0) = (0 ⊕ 0, 1 ⊕ 1, 1 ⊕ 0, 1 ⊕ 1, 1 ⊕ 1, 1 ⊕ 1, 0 ⊕ 0, 0 ⊕ 0) = (0, 0, 1, 0, 0, 0, 0, 0).
[0101] Similarly, the neighbor mask (0, 1, 1, 1, 0, 0, 0, 0) of the target node v1 is logically ORed with the cluster mask (0, 1, 0, 0, 0, 1, 1, 1) of the cluster 2, and the result is (0, 1, 1, 1, 0, 1, 1, 1). The result is logically XORed with the cluster mask (0, 1, 0, 0, 0, 1, 1, 1) of the cluster 2, and the result is (0, 0, 1, 1, 0, 0, 0, 0). There is 1 non-zero element in the comparison result (0, 0, 1, 0, 0, 0, 0, 0) of the target node v1 and the cluster 1, and there are 2 non-zero elements in the comparison result (0, 0, 1, 1, 0, 0, 0, 0) of the target node v1 and the cluster 2. According to the comparison result of the target node and the cluster 1 and the comparison result of the target node and the cluster 2, the target node can be allocated to the cluster 1. The number of clusters in the example in this embodiment is small, only 2 clusters, and the number of source nodes is also small. Imagine that in large-scale graph data, if a large number of clusters are to be clustered, and the number of source nodes is large, the advantages of calculation overhead, operation time, etc. will be highlighted when each target node is compared and allocated by logical operation.
[0102] In this embodiment, the neighbor mask and the cluster mask are both represented by binary vectors, so the neighbor mask and the cluster mask can be logically operated. By logically operating the neighbor mask of the target node and the cluster mask of the cluster as described above, the target node can be quickly compared with each cluster, and quickly allocated to the cluster with the most common source nodes. Therefore, by the method of this embodiment, the calculation overhead and the calculation time can be saved, and the training efficiency can be improved.
[0103] In some embodiments, when the cluster mask of the determined cluster is updated according to the neighbor mask of the target node, the updating can be implemented in the following manner:
[0104] performing a logical OR operation on the neighbor mask of the target node and the cluster mask of the determined cluster, and determining a result of the logical OR operation as the cluster mask of the determined cluster.
[0105] Since the cluster to which the target node is added needs to merge the source node of the newly added target node into the cluster mask, the merging by the logical OR operation is a fast and effective cluster mask updating means. The logical OR operation on the neighbor mask of the target node and the cluster mask of the determined cluster can be understood as merging the two binary vector represented masks by the logical OR operation.
[0106] The above is exemplified by the example of the above embodiment. After the target node v1 is assigned to cluster 1, the neighbor mask (0, 1, 1, 1, 0, 0, 0, 0) of the target node v1 can be logically ORed with the cluster mask (0, 1, 0, 1, 1, 1, 0, 0) of cluster 1, i.e., (0, 1, 1, 1, 0, 0, 0, 0) ∨ (0, 1, 0, 1, 1, 1, 0, 0) = (0, 1, 1, 1, 1, 1, 0, 0), and it can be known that the updated cluster mask (0, 1, 1, 1, 1, 1, 0, 0) of cluster 1 indicates that the source nodes of each target node in cluster 1 are (v2, v3, v4, v5, v6).
[0107] In this embodiment, the cluster mask of the cluster to which the target node is assigned can be updated by a relatively simple logical OR operation, achieving fast and accurate cluster mask updating with less computational overhead.
[0108] In some embodiments, at least two center nodes are determined from the plurality of target nodes, which can specifically be: determining the degrees of the target nodes from the plurality of target nodes; and determining at least two target nodes corresponding to the degrees in the front in the ordering of the degrees from large to small as the at least two center nodes according to the degrees of the target nodes.
[0109] The degree is the number of edges connected to the node, and the degree of a node can be quickly determined. Since the node with a larger degree indicates that the node is connected to multiple neighbor nodes, the target node with a larger degree can be a more important or critical node in the graph. Updating the feature information of the target node with a larger degree can more characteristically describe the local structure of the graph data. Determining the center nodes based on the degrees of the target nodes and clustering the clusters with the target nodes with higher degrees as the center nodes can maintain the structure information of the graph data as much as possible, balance the globality and locality of the graph data, and optimize the locality of the graph data.
[0110] For example, for any convolution layer, d target nodes are given in the convolution layer, first, the degrees of the target nodes are calculated, and in the order of degrees from large to small, the k target nodes corresponding to the degrees in the front of the order are determined as the center nodes of the k clusters. Wherein, d and k are positive integers, k is greater than or equal to 2 and k is less than or equal to d.
[0111] In this embodiment, the degrees of the target nodes are determined from the plurality of target nodes, and at least two target nodes corresponding to the degrees in the front of the order in the order of degrees from large to small are determined as at least two center nodes according to the degrees of the target nodes. Based on this, the center nodes are determined from the plurality of target nodes by degrees, and clustering is performed based on each center node, which can effectively maintain the local structure information of the graph data, so that each cluster after clustering is helpful to optimize the locality of the graph data.
[0112] In some embodiments, when each source node is assigned to the cluster with the most edges, it can be specifically implemented in the following way:
[0113] For any source node, the number of edges between the source node and the target nodes in each cluster is calculated according to the adjacency matrix corresponding to the convolution layer, to obtain the number of edges between the source node and each cluster; and the source node is assigned to the cluster with the largest number of edges according to the number of edges between the source node and each cluster.
[0114] For example, the adjacency matrix can be a matrix used to represent the edges between nodes in the graph data. For example, in the adjacency matrix of the graph data including n nodes, the first row represents node 1, the second row represents node 2, and so on, and the nth row represents node n; the first column represents node 1, the second column represents node 2, and so on, and the nth column represents node n. If the element value of the element in the ith row and jth column of the adjacency matrix is 0, it means that there is no edge between node i and node j; if the element value of the element in the ith row and jth column of the adjacency matrix is a non-zero value, it means that there is an edge between node i and node j, wherein n is any positive integer, and i and j are positive integers less than or equal to n. The number of edges between a node and one or more nodes can be quickly calculated by the adjacency matrix.
[0115] Clustering each target node into a cluster can be understood as the first stage of the lightweight two-stage dynamic clustering mechanism. The second stage is to assign each source node to a cluster. In the second stage, the information of the target nodes clustered in the first stage can be used to cluster each source node.
[0116] For example, the cluster degree is defined as the number of edges between the source node and the cluster, that is, the number of edges between the source node and all target nodes in the cluster, and the cluster degree can reflect the relationship strength between the source node and the cluster. The cluster degree of the source node and the cluster is determined, that is, the number of edges between the source node and the cluster is determined.
[0117] FIG. 5 is a schematic diagram of an adjacency matrix provided by an embodiment of the present disclosure. As shown in FIG. 5, for any convolution layer, an adjacency matrix A corresponding to the graph data of the convolution layer is obtained, and the cluster degree of each source node and each cluster can be dynamically calculated through the adjacency matrix A. For example, assuming that the target nodes in cluster 1 are target node v2, target node v5 and target node v7, when calculating the number of edges connected between source node v4 and the target nodes in cluster 1, the element values of the elements in the column of target node v2, target node v5 and target node v7 in the row corresponding to source node v4 in the adjacency matrix A are read, and the number of non-zero values is calculated, which is the number of edges connected between source node v4 and the target nodes in cluster 1. As shown in FIG. 5, there are two elements with non-zero values, indicating that the number of edges connected between source node v4 and the target nodes in cluster 1 is 2, i.e., the cluster degree of source node v4 and cluster 1 is 2. Through the adjacency matrix, the cluster degree between any source node and any cluster can be quickly determined, i.e., the cluster with the largest number of edges between the source node and the cluster can be quickly determined, and the source node can be allocated to the cluster. Alternatively, when determining the cluster degree, the non-zero element values can also be calculated in the column of the source node in the adjacency matrix, and the same effect can be achieved.
[0118] In the present embodiment, according to the adjacency matrix corresponding to the convolution layer, the number of edges connected between the source node and the target nodes in each cluster can be quickly calculated, and the number of edges between the source node and each cluster is obtained, so that the source node can be greedily allocated to the cluster with the largest number of edges. Based on this, the allocation of the maximum cluster degree of all source nodes can be quickly completed, and the allocation efficiency of the source nodes is improved.
[0119] In some embodiments, when the number of convolution layers is multiple, any convolution layer is the last convolution layer, and after the cluster corresponding to the last convolution layer is determined, the method further comprises:
[0120] For other convolution layers except the last convolution layer, the following operations are sequentially performed in reverse order: taking the source nodes of the next convolution layer of the current convolution layer as the target nodes of the current convolution layer, and the clustering result of the target nodes of the current convolution layer inherits the clustering result of the source nodes of the next convolution layer; and allocating the source nodes of the current convolution layer to the corresponding clusters to obtain the clusters corresponding to the current convolution layer.
[0121] For example, when a plurality of convolution layers are included in the graph convolution network, the processing of any convolution layer in the above embodiments can be the processing of the last convolution layer. After the cluster corresponding to the last convolution layer is determined based on the method of the above embodiments, the current convolution layer can be quickly clustered by reversely inheriting the clustering result of the source nodes of the next convolution layer. In some graph convolution networks, the last convolution layer can be the output layer of the graph convolution network.
[0122] For example, if three convolutional layers are included in the graph convolutional network, and the first convolutional layer, the second convolutional layer, and the third convolutional layer are named from the input end of the graph data to the output end, respectively, the clusters corresponding to the third convolutional layer can be determined by the method of any of the above embodiments, for example, the third convolutional layer clusters the cluster 1 and the cluster 2.
[0123] In some scenarios, the nodes of the target node in the previous convolutional layer are the source nodes in the next convolutional layer, and the nodes of the source node in the previous convolutional layer are the target nodes in the next convolutional layer. The source nodes and the target nodes are exchanged in the two adjacent convolutional layers, so the clustering result of the source nodes of the cluster 1 and the cluster 2 in the third convolutional layer can be inherited as the clustering result of the target nodes of the second convolutional layer, and when the second convolutional layer clusters the clusters, the process of determining multiple target nodes and assigning the clusters to the target nodes can be omitted, and the assignment of the source nodes can be performed according to the cluster degrees between the source nodes and the clusters in the second convolutional layer to obtain the clusters corresponding to the second convolutional layer. Therefore, the clustering efficiency of the second convolutional layer can be improved. Similarly, after the source nodes are clustered by the second convolutional layer, the clustering result of the source nodes can be inherited as the clustering result of the target nodes of the first convolutional layer, and the clustering efficiency of the first convolutional layer is also improved.
[0124] In the embodiment, when the number of convolutional layers is multiple, for the convolutional layers other than the last convolutional layer, the source nodes of the next convolutional layer of the current convolutional layer are sequentially taken as the target nodes of the current convolutional layer in reverse order, and the clustering result of the target nodes of the current convolutional layer inherits the clustering result of the source nodes of the next convolutional layer; the source nodes of the current convolutional layer are assigned to the corresponding clusters to obtain the clusters corresponding to the current convolutional layer. Based on this, the time for clustering the clusters corresponding to the convolutional layers of the graph convolutional network including multiple convolutional layers can be shortened, the consumption of computing resources can be reduced, and the training efficiency of the graph convolutional network can be effectively improved. For example, in the training process of the graph convolutional network, the data dimension of the graph data is greatly different between the full batch and the non-full batch training strategies, and different data dimensions greatly affect the computing efficiency in the data computing process. Therefore, in order to improve the computing efficiency, the method of the embodiment proposes a reconfigurable computing sequence mechanism for optimizing the selection of the matrix multiplication sequence in the full batch and the non-full batch training strategies, determines a more optimal computing sequence by dynamically adjusting the computing sequence, thereby reducing the computing overhead and improving the training efficiency of the graph convolutional network.
[0125] In some embodiments, according to the clusters after clustering of any convolutional layer, the feature information of the nodes in the clusters after clustering is read and stored in the cache, and the output result of the convolutional layer is obtained according to the feature information stored in the cache, comprising:
[0126] According to the clustered clusters corresponding to each volume layer, the feature information of the nodes in the clustered clusters is read and stored in the cache, and the weight matrix and the adjacency matrix to be calculated with the feature information are determined; according to the training strategy of the graph convolution network or the number of rows and columns of the adjacency matrix, the multiplication order of the feature information, the weight matrix and the adjacency matrix is determined, and the feature information, the weight matrix and the adjacency matrix are calculated according to the multiplication order, to obtain the output result of the convolution layer.
[0127] Exemplarily, for each clustered cluster corresponding to each volume layer, the feature information of the nodes of one or more clusters can be read in batches and stored in the cache area. When updating the calculation, the feature information can be a feature information matrix of each node, and each row in the feature information matrix represents each node, and each column represents each feature value of the node corresponding to the row. The weight matrix to be calculated with the feature information can be obtained by reading the model parameters of each volume layer of the graph convolution network. The adjacency matrix can be obtained by inputting the graph data or according to the graph data corresponding to each volume layer.
[0128] The training strategy of the graph convolution network can include full batch training and non-full batch training, wherein the full batch training can be understood as updating the feature information of all nodes in the graph data during training, and the non-full batch training can be understood as updating the feature information of only part of the nodes in the graph data during training. The adjacency matrix can also be a matrix representing the connection relationship between the target nodes and the source nodes, and when the number of target nodes and the number of source nodes are different, the number of rows and columns of the adjacency matrix is different.
[0129] FIG. 6 is a schematic diagram of full batch training provided by an embodiment of the present disclosure. As shown in FIG. 6, when the full batch training strategy is performed in the I+1 layer of the graph convolution network, for example, the feature information of each node is updated, i.e., each node is a target node, wherein I is a natural number. The number of rows and columns of the adjacency matrix of the full batch training is the same, i.e., the number of all nodes, and the adjacency matrix has the same meaning as the adjacency matrix in the above embodiments. The filled squares in the adjacency matrix represent that the element value of the corresponding elements of the rows and columns is a non-zero value, and the unfilled squares represent that the element value of the corresponding elements of the rows and columns is zero.
[0130] FIG. 7 is a schematic diagram of non-full batch training according to an embodiment of the present disclosure. As shown in FIG. 7, when non-full batch 0 training is performed in the lth layer of the graph convolution network, the feature information of the node v3 and the node v4 is updated, i.e., the node v3 and the node v4 are target nodes, the source nodes corresponding to each target node include the node v2, the node v5, the node v6 and the node v7, and the number of rows and columns in the adjacency matrix of the non-full batch training can be different. When non-full batch 0 training is performed in the l+1th layer which is a subsequent convolution layer of the lth layer of the graph convolution network, the feature information of the node v2 and the node v5 is updated, i.e., the node v2 and the node v5 are target nodes, the source nodes corresponding to each target node include the node v3 and the node v4, and the nodes v6 and v7 represented by the dashed circles in this layer are unsampled nodes. Although the node v6 is a neighbor node of the node v5 and the node v7 is a neighbor node of the node v3, the nodes v6 and v7 are not sampled during the feature information update, and thus the unsampled nodes can be omitted in the adjacency matrix.
[0131] FIG. 8 is another schematic diagram of non-full batch training according to an embodiment of the present disclosure. As shown in FIG. 8, similar to the non-full batch 0 shown in FIG. 7, when non-full batch 1 training is performed, the target nodes and the source nodes of the lth layer and the l+1th layer can be interchanged. The nodes represented by the dashed circles are unsampled nodes, and more neighbor nodes can not be sampled by the target nodes as the layer progresses. The adjacency matrix of the lth layer of the non-full batch 1 and the adjacency matrix of the l+1th layer of the non-full batch 1 are shown in the figure. The non-full batch 0 and the non-full batch 1 can be understood as non-full batch codes for distinguishing different non-full batch strategies.
[0132] According to the cluster corresponding to each convolution layer, after reading the feature information of the nodes in the clustered cluster and determining the weight matrix and the adjacency matrix to be calculated with the feature information, the multiplication order of the feature information, the weight matrix and the adjacency matrix can be dynamically determined according to the training strategy of the graph convolution network or the number of rows and columns of the adjacency matrix, with the goal of reducing the computational overhead, and the multiplication order can be used for calculation to obtain the output result of the convolution layer.
[0133] In this embodiment, the multiplication order of the feature information, the weight matrix and the adjacency matrix is determined according to the training strategy of the graph convolution network or the number of rows and columns of the adjacency matrix, and the feature information, the weight matrix and the adjacency matrix are calculated according to the multiplication order to obtain the output result of the convolution layer. In the case of limited computing resources, the computing resources can be reasonably utilized for operation, the workload of the storage unit and the calculation unit during operation is reduced, and the efficiency of operation is improved.
[0134] For example, when the graph convolution network is trained, the calculation formula of the forward propagation can be represented as the following formula (1) and formula (2): l = AXl W l (1)
[0135] X l+1 = σ(Z l ) (2)
[0136] wherein, A represents an adjacency matrix; X l represents feature information corresponding to the lth convolutional layer, which can be a feature information matrix of each node corresponding to the lth convolutional layer; W l represents a weight matrix of the lth convolutional layer; Z l represents a result matrix obtained by the lth convolutional layer after performing calculation on the adjacency matrix, the feature information and the weight matrix; σ represents an activation function, such as relu; X l+1 represents feature information corresponding to the (l+1)th convolutional layer, which is feature information obtained after each node of the lth convolutional layer is updated.
[0137] The calculation formula of the back propagation can be represented as the following formula (3) to formula (5):
[0138] wherein, represents a partial derivative of the result matrix; represents a partial derivative of the weight matrix; represents a partial derivative of the feature information; X l T represents a transpose matrix of the feature information; A T represents a transpose matrix of the adjacency matrix; W l T represents a transpose matrix of the weight matrix.
[0139] In some embodiments, when the forward propagation, if the training strategy of the graph convolutional network is full batch training, or if the training strategy is non-full batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, the multiplication order is: performing multiplication operation on the feature information and the weight matrix, and performing multiplication operation on the obtained product and the adjacency matrix; if the training strategy is non-full batch training and the number of rows of the adjacency matrix is less than the number of columns, the multiplication order is: performing multiplication operation on the adjacency matrix and the feature information, and performing multiplication operation on the obtained product and the weight matrix.
[0140] Exemplarily, when determining the calculation order in the forward propagation, mainly involves formula (1), there are two calculation orders of the three calculation factors in formula (1), which are A(X l W l ) and (AX l )W l , that is, it is necessary to determine whether to calculate Xl the product of A and X l , or first calculate the product of A and X l .
[0141] Since the calculation cost is smaller when first calculating the product of X l and W l and then calculating the product of A and X l W l during the forward propagation of the full batch training, during the forward propagation, if the training strategy of the graph convolution network is full batch training, the product operation can be performed on the feature information and the weight matrix, and the obtained product can be multiplied by the adjacency matrix to obtain the output result of the convolution layer.
[0142] Since the adjacency matrix A in each convolution layer is dynamic and the data dimension thereof is asymmetric, during the forward propagation of the non-full batch training, a dynamic calculation order can be adopted. The calculation order can be determined according to the dimension of A sampled in each non-full batch calculation, and the matrix with a smaller dimension is generated in priority to minimize the calculation cost.
[0143] If the training strategy is non-full batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, for example, the dimension of the adjacency matrix A corresponding to the convolution layer during the non-full batch training is n x m, and n ≥ m, the calculation cost is smaller when first calculating the product of X l and W l and then calculating the product of A and (X l W l ). If the training strategy is non-full batch training and the number of rows of the adjacency matrix is smaller than the number of columns, that is, n < m, the calculation cost can be reduced when first calculating the product of A and X l and then calculating the product of (AX l ) and W l . Therefore, if the training strategy of the graph convolution network is non-full batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, the product operation can be performed on the feature information and the weight matrix, and the obtained product can be multiplied by the adjacency matrix to obtain the output result of the convolution layer. If the training strategy is non-full batch training and the number of rows of the adjacency matrix is smaller than the number of columns, the product operation can be performed on the adjacency matrix and the feature information, and the obtained product can be multiplied by the weight matrix to obtain the output result of the convolution layer.
[0144] Illustratively, the convolution layer can perform convolution operation based on the feature information of each node input to the convolution layer, and the weight matrix and the adjacency matrix to be calculated with the feature information, to obtain the updated feature information of each node, which is the output result of the convolution layer. The output result can be used in the process of back propagation to adjust the model parameters of the convolution layer, for example, the weight matrix of the convolution layer can be adjusted based on the output result.
[0145] In this embodiment, during forward propagation, if the training strategy of the graph convolutional network is full-batch training, or if the training strategy is non-full-batch training and the number of rows in the adjacency matrix is greater than or equal to the number of columns, then according to A(X l W l The feature information, weight matrix, and adjacency matrix are multiplied sequentially; if the training strategy is non-full-batch training and the number of rows in the adjacency matrix is less than the number of columns, then the product operation is performed according to (AX). l W l The feature information, weight matrix, and adjacency matrix are multiplied sequentially; this reduces computational overhead and improves training efficiency.
[0146] In some embodiments, during backpropagation, if the training strategy of the graph convolutional network is full-batch training, or if the training strategy is non-full-batch training and the number of rows in the adjacency matrix is greater than or equal to the number of columns, the corresponding multiplication order when calculating the partial derivative of the weight matrix is as follows: multiply the partial derivative of the transpose of the adjacency matrix with the partial derivative of the result matrix, and multiply the resulting product with the transpose of the feature information, wherein the result matrix is the matrix obtained after multiplying the adjacency matrix, feature information, and weight matrix during forward propagation; when calculating the partial derivative of the feature information, the corresponding multiplication order is as follows: multiply the partial derivative of the transpose of the adjacency matrix with the partial derivative of the result matrix, and multiply the resulting product with the transpose of the weight matrix;
[0147] If the training strategy is not full-batch training and the number of rows in the adjacency matrix is less than the number of columns, the corresponding multiplication order when calculating the partial derivative of the weight matrix is: multiply the transpose of the feature information matrix with the transpose of the adjacency matrix, and then multiply the resulting product with the partial derivative of the result matrix; when calculating the partial derivative of the feature information matrix, the corresponding multiplication order is: multiply the partial derivative of the result matrix with the transpose of the weight matrix, and then multiply the resulting product with the transpose of the adjacency matrix.
[0148] For example, determining the computation order during backpropagation mainly involves formulas (4) and (5). In full-batch computation, considering that formula (4) has two possible computation orders, namely... and because Usually more than X l Having smaller dimensions, first calculate This will generate a smaller matrix, so computation is preferred. calculate Another advantage is that its result can be repeatedly used in the calculation of formula (5). Verification shows that... The order of calculation compared to The calculation order of formula (4) and formula (5) needs less multiply-accumulate operation (MAC), so the calculation order of formula (4) is selected in the back propagation of the full batch training strategy. The calculation order of formula (5) is selected in the back propagation of the full batch training strategy. The order of calculation of formula (4) and formula (5) can improve the efficiency of back propagation.
[0149] Exemplarily, if the training strategy is non-full batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, that is, n≥m of the adjacency matrix A, the calculation order of formula (4) and formula (5) can be the same as the calculation order of the back propagation in the full batch training strategy, so as to reduce the calculation overhead and improve the training efficiency.
[0150] If the training strategy is non-full batch training and the number of rows of the adjacency matrix is less than the number of columns, that is, n The calculation order of formula (5) is selected in the back propagation of the full batch training strategy. The order of calculation of formula (4) and formula (5) can improve the efficiency of back propagation. As shown in FIG. 7, in the training process of the I+1 layer non-full batch 0, the dimension of the adjacency matrix A is 2x2, that is, n=m, the calculation order of formula (4) is selected as The calculation order of formula (5) is selected in the back propagation of the full batch training strategy. W l T As shown in FIG. 8, in the training process of the I+1 layer non-full batch 1, the dimension of the adjacency matrix A is 2x3, that is, n The calculation order of formula (5) is selected in the back propagation of the full batch training strategy. The order of calculation of formula (4) and formula (5) can improve the efficiency of back propagation.
[0151] Exemplarily, in the back propagation, the convolution layer can calculate the partial derivative of the result matrix based on the feature information X l The output result X l+1 is obtained in the forward propagation, and the partial derivative of the result matrix is calculated. The partial derivative of the weight matrix and the partial derivative of the feature information is obtained based on and The output of the convolutional layer during back propagation can be obtained, for example, the output can be a value of a loss function used to adjust the weight matrix. After obtaining the output of each convolutional layer during back propagation, the model parameters of the graph convolutional network are adjusted based on the output, and one round of training is completed, so that the calculation efficiency of the two stages of forward propagation and back propagation is improved, and the efficiency of one round of training is greatly improved.
[0152] Optionally, after multiple rounds of forward propagation and back propagation, i.e. after multiple rounds of training, when the updated feature information output by the forward propagation of the convolutional layer of the graph convolutional network has relatively accurate representation, it can be determined that the training of the graph convolutional network is completed. Wherein, whether the representation of the output updated feature information is relatively accurate can be determined according to the application requirements in specific scenarios.
[0153] In this embodiment, the calculation order is determined according to the training strategy, which is a mechanism for reconfiguring the calculation order. During back propagation, through the reconfigurable calculation order mechanism, the calculation overhead in GCN training is significantly reduced, the training efficiency is improved, and the change of different data dimensions is adapted by dynamically adjusting the calculation order, providing an efficient solution for full batch training and non-full batch training. Through this mechanism, the training process of GCN can be effectively optimized, especially when dealing with large-scale graph data, providing a more efficient and flexible calculation strategy.
[0154] Exemplarily, during the training of a graph convolutional network, due to the sparsity and irregularity of graph data, the training efficiency is affected by factors such as storage and computing efficiency, irregular neighborhood structure, balance between locality and globality, and the like. Specifically, on the one hand, there are many sparse matrices in the graph data. Since a sparse matrix includes a large number of zero elements, the existing matrix operation method usually has low storage and computing efficiency when operating on a sparse matrix. Therefore, setting an efficient sparse matrix operation and storage method is an important aspect of improving the performance of a graph convolutional network. On the other hand, the degree and connection mode of nodes in the graph can be very irregular, some nodes can have very few neighbor nodes, and other nodes can have a large number of neighbor nodes, which is the phenomenon of irregular neighborhood structure. The irregularity of graph data makes the existing batch processing method more complex and cannot be applied to graph data computation with irregular neighborhood structure. Therefore, an algorithm that adapts to irregular neighborhood structure needs to be designed to fully utilize hardware acceleration devices and improve computing efficiency. On the other hand, a graph convolutional network usually updates the representation of each node by aggregating the information of neighbor nodes, which involves the transmission of local information. However, due to the irregularity of the graph, a balance needs to be found between local information transmission and global information integration. When designing a graph convolutional network, it is necessary to consider how to effectively utilize local and global information to balance locality and globality while improving computing efficiency. In order to cope with these challenges, new GCN architectures, optimization methods and hardware acceleration strategies are constantly being proposed in the field to better handle sparse and irregular graph data, thereby improving the efficiency of training and inference.
[0155] Sparse matrix multiplication generally has two forms, namely Sparse-Dense Matrix Multiplication (SDMM) and Sparse-Sparse Matrix Multiplication (SPMM). SDMM is a matrix multiplication operation in which one matrix is sparse and the other is dense. Sparse matrices contain a large number of zero elements, while dense matrices are mostly non-zero elements. SPMM is an operation for processing the multiplication of two sparse matrices, where both the input matrix and the weight matrix have a large number of zero elements. In deep learning and neural networks, SPMM is an important computational operation, especially when dealing with large-scale data, which can significantly improve computational efficiency. The basic idea of SPMM is to only calculate the product of non-zero elements in the input matrix and the weight matrix, thereby avoiding unnecessary calculations on zero elements. This is very important for processing sparse data structures, because in practical applications, input data and weights are usually highly sparse, i.e. most elements are zero. The advantage of sparse matrix multiplication is to reduce the overhead of computation and storage, and improve the efficiency of neural networks. It has been widely used in various deep learning models such as Convolutional Neural Network (CNN), Graph Neural Network, etc. In practical situations, sparse matrix multiplication can be implemented through various algorithms and data structures to more effectively handle the multiplication of sparse matrices. This is particularly important for processing large-scale data, graph data, or applications that need to run in resource-constrained environments.
[0156] To improve the efficiency of sparse matrix multiplication in graph convolutional networks, the GCN's heterogeneous accelerator or SDMM-based architecture can be improved. In the heterogeneous architecture, special engines are designed for the aggregation stage and the joint stage in the GCN forward propagation. For example, a Single Instruction, Multiple Data (SIMD) based aggregation engine and a systolic array based joint engine are used to accelerate the computation of the aggregation stage and the joint stage, respectively. This heterogeneous architecture has good results on certain specific datasets, but cannot fully utilize the resources of the two engines. Since the proportion of the aggregation stage and the joint stage varies for different datasets, and the computing power of the two engines is fixed, there will be a problem of load imbalance between the two engines.
[0157] In the SDMM-based architecture, such as Adaptive Weighted Bilateral Graph Convolutional Network (AWB-GCN) and Graph Convolutional Network with Adaptive eXponential neighborhood (GCNAX), they observe that the GCN forward propagation contains multiple sparse matrices, so they accelerate the GCN forward propagation by supporting SDMM. AWB-GCN focuses on the load imbalance problem in SDMM, and proposes an SDMM-based architecture to dynamically balance the workload of multiple Processing Elements (PEs). GCNAX explores the characteristics of different datasets and designs a configurable matrix multiplication loop scheduling and merging mechanism to optimize SDMM. In general, the SDMM-based architecture focuses on optimizing the SDMM in the GCN forward propagation.
[0158] Gustavson algorithm is an algorithm for efficient execution of matrix multiplication, mainly including steps such as blocking, skipping zero elements, data rearrangement, and parallelization. Specifically, the sparse matrix is divided into blocks, and each block is operated. By detecting and skipping zero elements in the sparse matrix, unnecessary calculations are reduced. The data of the sparse matrix is rearranged to improve the effective use of the cache and reduce cache misses. The characteristics of parallel computing are used to improve the overall computing performance. The performance improvement of Gustavson algorithm is mainly due to the optimization of its data access mode and computing process, making the calculation more efficient on modern computer architecture.
[0159] The above-mentioned schemes are all for the acceleration of GCN inference, and there is no accelerator for GCN training. Given that GCN is a semi-supervised learning method, it needs to be trained before inference, so there is an urgent need for a novel and efficient accelerator design to make GCN adapt to larger inputs and achieve fast training. The existing scheme only considers the SDMM in the GCN forward propagation process, and does not consider the SPMM in the GCN backward propagation process, so the above-mentioned method is not suitable for the acceleration of the entire GCN training process. Due to the neglect of SPMM by each scheme, there will be a lot of redundant calculations and memory accesses for zero elements when calculating GCN training using the above-mentioned method, resulting in waste of computing and memory resources.
[0160] The embodiments of the present disclosure provide an efficient GCN training accelerator, which is characterized by unified support for SDMM and SPMM to improve the forward and backward propagation efficiency of GCN. The accelerator specially customizes an access strategy without plate conflict and an offline rearrangement technology, effectively reducing the data movement cost and improving the utilization efficiency of resources.
[0161] In some embodiments, the graph convolution training method described above further includes: in the training process, for any first matrix and second matrix to be multiplied, when the first matrix is a sparse matrix of MxK, and the second matrix is a sparse matrix of KxN or a dense matrix, the multiplication result of the first matrix and the second matrix is calculated by N PEs in parallel.
[0162] wherein M, K and N are positive integers, the N PEs correspond to the N columns of the second matrix one by one, and are used to calculate the multiplication result of the corresponding column; any PE is specifically used to read the elements in each column of the first matrix in turn, and calculate with the elements of the corresponding column, and when the PE reads any target column in the first matrix, if another PE is reading the target column, the PE acquires the reading result of the other PE, and if the acquired reading result is part of the elements of the target column, after the other PE finishes reading the target column, the PE reads the other elements in the target column except the part of the elements.
[0163] Exemplarily, the PE is a processing unit, and the plurality of PEs calculate the multiplication result of the first matrix and the second matrix in parallel, and each PE is responsible for calculating the elements of a column.
[0164] Exemplarily, sparse matrix multiplication can include two processing methods: one is sparse matrix multiplication based on compressed sparse row (CSR) and row-wise data flow. CSR is a compression format for compressing a sparse matrix by row, which reduces the storage space by storing only the values and corresponding row indexes of non-zero elements, and performs fast reading of sparse matrix multiplication. Row-wise refers to an operation of multiplying each row of a matrix with a row of another matrix element by element. This operation is performed independently for each row of the matrix, and the result is a new row containing the multiplication result of the elements at each position. The other is sparse matrix multiplication based on compressed sparse column (CSC) and column-wise data flow. CSC is a compression format for compressing a sparse matrix by column, which reduces the storage space by storing only the values and corresponding column indexes of non-zero elements, and performs fast reading of sparse matrix multiplication. Column-wise refers to an operation of multiplying each column of a matrix with a column of another matrix element by element. This operation is performed independently for each column of the matrix, and the result is a new column containing the multiplication result of the elements at each position.
[0165] The method provided by the embodiment is based on a column-wise sparse matrix multiplication data stream to simultaneously support SDMM and SPMM. The sparse matrix multiplication can be abstracted into a representation of O = AB, where the A matrix represents a first matrix, the B matrix represents a second matrix, and the O matrix represents a result matrix of the multiplication operation. When the method is executed, the data stream calculates a product of one element of the B matrix and an entire column of the A matrix each time to obtain a partial sum of an entire column of the O matrix. Each PE reads one element of the B matrix each time, reads a corresponding column of the A matrix according to a row number of the B matrix, and obtains a row and a column of the output according to the row number of the A matrix and the column number of the B matrix. Different PEs are statically mapped to different columns of the B matrix, are responsible for the calculation of the corresponding columns, and obtain different columns of the output.
[0166] FIG. 9 is a data stream diagram of the multi-PE parallel computation provided by the embodiment of the present disclosure, as shown in FIG. 9, the black blocks represent zero elements, and the white blocks represent nonzero elements. The PE 0 and the PE 1 are responsible for the 0th column (the column numbers are numbered from 0 in sequence) and the 1st column of the B matrix respectively to obtain the 0th column and the 1st column of the O matrix. Taking the PE 0 as an example, the PE 0 reads the first nonzero element from the 0th column of the B matrix, and the row number is 1 (the row numbers are numbered from 0 in sequence). Correspondingly, the PE 0 reads the 1st column of the A matrix and multiplies it with the nonzero element of the B matrix. According to the row number of the nonzero element in the A matrix and the column number of the nonzero element in the B matrix, the PE 0 can obtain the row number and the column number in the output O matrix, and accumulate the results of the partial sums in the O matrix. Based on the multi-PE parallel computation data stream, the calculation of the zero elements in the sparse matrix multiplication can be eliminated to accelerate the sparse matrix multiplication.
[0167] Specifically, the multi-PE parallel computation data stream can reuse the nonzero elements in the B matrix to complete the calculation of the entire column of the A matrix, thereby reducing the repeated access to the B matrix. Moreover, each PE is responsible for calculating the multiplication of one nonzero element in the B matrix and the nonzero elements of the corresponding column of the A matrix, avoiding the calculation of the zero elements in the sparse matrix multiplication, and improving the calculation speed of the sparse matrix multiplication. In addition, the A matrix and the B matrix are compressed in the CSC format, and the redundant access to the zero elements in the sparse matrix can be eliminated.
[0168] Optionally, to implement the multi-PE parallel computation, the embodiment of the present disclosure provides a bank design to support the parallel memory access of different PEs. Three banks of cache can be set to store the A matrix, the B matrix and the O matrix respectively, namely AMBuff, BMBuff and OMBuff. Assuming that the dimensions of the A matrix, the B matrix and the O matrix are (M x K), (K x N) and (M x N) respectively, the number of banks of AMBuff, BMBuff and OMBuff is K, N and N respectively, and each bank stores the data of a column in the matrix. The number of PEs is also N, each PE is directly connected to the corresponding banks of BMBuff and OMBuff, and is connected to all banks of AMBuff through a crossbar. When M, K and N are larger, the area of the on-chip cache required is larger, and the off-chip memory access is less. Therefore, the embodiment adopts the matrix bank division method to balance the on-chip area and the off-chip memory access.
[0169] For example, a configuration of M = 1024, N = 16 and K = 16 is adopted. Considering that the A matrix and the B matrix are sparse matrices, and the O matrix is a dense matrix, the embodiment adopts the compressed sparse column (CSC) format to save the A matrix and the B matrix, and uses the dense format to save the O matrix. FIG. 10 is a schematic diagram of the bank memory data flow provided by the embodiment of the present disclosure, as shown in FIG. 10, bank 1 in AMBuff stores the non-zero elements of the first column of the A matrix and the corresponding row numbers. In the Tth and (T + 1)th clock cycles, PE 1 reads the non-zero elements b 1,1 and the corresponding row numbers. Correspondingly, PE 1 reads all the non-zero elements of the first column of the A matrix, and calculates the product with b 1,1 , and finally writes the product and the corresponding partial sum back to OMBuff for storage.
[0170] The existing row-wise and column-wise data flow based sparse matrix multiplication has the problem of bank conflict, which slows down the memory access speed of the same bank. FIG. 11 is a schematic diagram of bank conflict provided by the embodiment of the present disclosure, as shown in FIG. 11, when two elements of different columns in the B matrix are multiplied by the second column of the A matrix at the same time, the two elements of the B matrix both access the elements of the same column of the A matrix, thus causing the problem of bank conflict. Therefore, the embodiment of the present disclosure provides a mechanism to eliminate bank conflict, to improve the parallel degree of multi-PE parallel computation, thereby accelerating the sparse matrix multiplication.
[0171] Exemplarily, for each column of the A matrix, a pointer can be set to point to the element in the column that is currently being accessed. When different elements of the B matrix access the same element of the A matrix, the element of the A matrix that is being accessed is broadcast to different PEs, thereby merging the access requests for the same element, and eliminating the tile conflict problem existing in the data stream in the process of matrix multiplication. When different elements of the B matrix access different elements of the same column of the A matrix, the access order of the column elements of the A matrix in the original data stream can be changed, and the column elements of the A matrix can be accessed in the order of the pointer movement instead of from head to tail. The mechanism can be understood as a tile conflict elimination mechanism.
[0172] FIG. 12 is a schematic diagram of a tile conflict elimination mechanism provided by an embodiment of the present disclosure, FIG. 13 is a schematic diagram of a tile conflict elimination mechanism provided by an embodiment of the present disclosure, and FIG. 14 is a schematic diagram of a tile conflict elimination mechanism provided by an embodiment of the present disclosure. As shown in FIGS. 12 to 14, PE 0 and PE 1 are respectively responsible for calculating the results of multiplication of two columns of the matrix B and the corresponding columns of the matrix A. In the T+1 clock cycle, PE 0 and PE 1 access a 0,2 and a 3,1 These two elements, wherein CG-AMBuff represents the cache after adding the pointer on the AMBuff. Since a 0,2 and a 3,1 These two elements are located in tile 1 and tile 2 respectively, and therefore no tile conflict occurs. In the T+2 clock cycle, PE 0 and PE 1 simultaneously access the elements in the second column of tile 2 in the CG-AMBuff. If the order is according to the original conflict-free mechanism, b 2,0 should be multiplied by a 1,2 to obtain 0 1,0 , and b 2,1 should be multiplied by a 0,2 to obtain 0 0,1 . According to this order, PE 0 and PE 1 will simultaneously access two different elements of tile 2, and therefore a conflict occurs, causing memory access delay. In order to improve the memory access speed, the tile conflict elimination mechanism is introduced, and the elements b 2,1 are caused to be calculated with the elements in the column of the A matrix in the order of the pointer movement. Therefore, according to the data stream with the conflict elimination mechanism, element b 2,1 is first multiplied by a 1,2 instead of a 0,2 , to obtain o 1,1 . In the T+3 clock cycle, the pointer moves to the end of the second column of the A matrix and then returns to the first element. At this time, element b 2,1 is multiplied by a 0,2 to obtain a 0,1In this way, the access to different elements of the same column of the A matrix in the same clock cycle can be eliminated, that is, the access request to the same element is combined, the plate conflict problem existing in sparse matrix multiplication is solved, and the memory access of sparse matrix multiplication is accelerated.
[0173] Exemplarily, the reasonable use of cache space in sparse matrix operation has a great influence on the improvement of computing efficiency and the arrangement of hardware resources. In order to reduce the size of on-chip cache, in some embodiments, the matrices in GCN training can be calculated and stored in a block manner. The column of each matrix block can be designed as a whole target with a similar number of non-zero elements. For example, the column elements in adjacent matrix blocks in the A matrix can be rearranged offline according to the number of non-zero elements in the matrix.
[0174] Specifically, given the number of adjacent matrix blocks in the A matrix as s, it can be understood that the A matrix is divided into s matrix blocks. Before GCN training, the columns in the s adjacent matrix blocks can be sorted in descending order according to the number of non-zero elements, so that the number of non-zero elements in different columns in the same matrix block is as equal as possible. After rearrangement, the load balancing in each matrix block of the A matrix can be realized more efficiently. In addition, the column numbers of the columns of the A matrix before rearrangement can be recorded to guide the rearrangement of the corresponding rows of the B matrix during the calculation operation.
[0175] FIG. 15 is a schematic diagram of offline rearrangement provided by an embodiment of the present disclosure. As shown in FIG. 15, for the matrix block P0 and the matrix block P1 in the A matrix, the columns of the two adjacent matrix blocks P0 and P1 are rearranged according to the number of non-zero elements in each column of each matrix block. As can be seen from the figure, the columns (0, 1, 2) in the matrix block P0 are rearranged to columns (1, 2, 3); the columns (3, 4, 5) in the matrix block P1 are rearranged to columns (0, 4, 5). As can be seen, each column of the matrix block P0 contains the same number of non-zero elements, and each column contains 3 non-zero elements; each column of the matrix block P1 contains the same number of non-zero elements, and each column contains 1 non-zero element. In this way, the workloads of each matrix block in the A matrix are balanced. At the same time, the column numbers of the initial columns, which are (1, 2, 3) and (0, 4, 5), can be used to rearrange the corresponding rows of the B matrix during the operation.
[0176] After rearranging the matrix A, in order to facilitate the matrix multiplication of O = AB, the matrix B can be rearranged. Specifically, since the adjacent s matrix blocks in the matrix A are multiplied with the corresponding matrix blocks in the matrix B, the rows of the adjacent s matrix blocks in the matrix B can be rearranged synchronously at the calculation runtime. As shown in FIG. 15, during the GCN training, the rows (1, 2, 3) are rearranged as the rows (0, 1, 2) in the matrix B. From the perspective of hardware implementation, in order to ensure the sequential on-chip memory access to the matrix B, a rearrangement (Reshuffle) buffer Reshuffle BMBuff can be set to save the s adjacent matrix blocks in the matrix B. Therefore, the rows of the matrix B can be rearranged on-chip without generating discontinuous off-chip memory requests.
[0177] FIG. 16 is a schematic diagram of the connection of the rearrangement hardware device provided in the embodiments of the present disclosure. As shown in FIG. 16, the Reshuffle BMBuff first prefetches the s adjacent matrix blocks of the matrix B. The CG-AMBuff reads the matrix blocks of the rearranged matrix A from the off-chip memory, and the Reshuffle BMBuff reads the column index of the matrix A before rearrangement, i.e., the initial column ID. According to the initial column ID of the matrix A, the Reshuffle BMBuff sends the row number of the corresponding matrix B to the BMBuff. Each processing element PE calculates the product of the non-zero elements in a column of the matrix B and the corresponding column of the matrix A, generates the partial sum in the corresponding matrix O, and finally writes back to the OMBuff. The number s of the adjacent matrix blocks affects the effectiveness of the offline rearrangement technique and the overhead of the Reshuffle BMBuff. For example, s can be set to 16 to balance the efficiency and the overhead. Through the matrix rearrangement technique, the problem of load imbalance in the GCN training process can be alleviated, and the training of the GCN can be accelerated.
[0178] The embodiments of the present disclosure further provide a graph data processing method. FIG. 17 is a flowchart of a graph data processing method provided in the embodiments of the present disclosure. As shown in FIG. 17, the method comprises the following steps:
[0179] In step 1701, graph data to be processed is obtained.
[0180] In step 1702, the graph data is processed based on a graph convolutional network to obtain a corresponding processing result.
[0181] The graph convolutional network is trained based on the graph convolutional network training method in any of the above embodiments.
[0182] Exemplarily, the to-be-processed graph data can be graph data obtained through graph data conversion from data obtained according to application scenarios such as a social network, a molecular structure, a recommendation system, and the like. For example, in a recommendation system, based on multiple user information data, multiple commodity information data, and correlation data between the users and the commodities in the recommendation system, graph data conversion is performed to construct graph data about the users and the commodities in the recommendation system, and the to-be-processed graph data can be obtained by reading the graph data.
[0183] Optionally, according to the task requirements in specific application scenarios, the graph convolutional network obtained through the training method provided in any of the above embodiments is fine-tuned to obtain a graph convolutional network that can perform tasks in specific application scenarios. The graph convolutional network can shorten the training time of the early training and can be quickly put into the application stage after fine-tuning. The to-be-processed graph data obtained is input into the trained graph convolutional network, and the graph convolutional network can output a processing result of processing the graph data in a specific application scenario.
[0184] For example, the task requirements of the recommendation system can be node classification and recommendation based on updated feature information of each node in the graph data. In the neighbor nodes of the user corresponding node, the neighbor nodes corresponding to the commodities are classified into nodes worthy of recommendation and nodes not worthy of recommendation, and the commodities corresponding to the neighbor nodes worthy of recommendation are output as output results. The graph convolutional network obtained based on the training method of each of the above embodiments can provide relatively accurate updated feature information. Classification and recommendation based on the updated feature information can be the ability of the graph convolutional network after fine-tuning.
[0185] For example, in an application program with a commodity recommendation function, data of multiple users and multiple commodities is obtained and converted into graph data. After the graph data is processed based on the fine-tuned graph convolutional network, the processing result can include one or more commodity information recommended to one or more users, and the commodity information can include recommended commodity names, commodity attributes, and commodity prices, and the like.
[0186] The specific implementation principles and processes of the steps in this embodiment can be referred to the foregoing embodiments, which will not be described here.
[0187] In the graph data processing method provided in this embodiment, the graph convolutional network trained with high training efficiency is suitable for scenarios with certain requirements for training time and training resource investment, has high adaptability, and can be applied to more graph data processing scenarios.
[0188] The embodiment of the present disclosure further provides a graph convolutional network training apparatus, the graph convolutional network comprising at least one convolutional layer, and the at least one convolutional layer is configured to process graph data, the graph data comprising a plurality of nodes and edges between the nodes; the apparatus comprises:
[0189] a determination module configured to determine, for any convolutional layer, a plurality of target nodes to be processed by the convolutional layer and source nodes of the target nodes, the target nodes being nodes to be updated in feature information, and the source nodes of the target nodes being nodes in neighbor nodes of the target nodes and used for updating the target nodes in feature information;
[0190] an assignment module configured to determine at least two center nodes from the plurality of target nodes, any center node corresponding to a cluster, and assign the remaining target nodes except the center nodes in the plurality of target nodes to a cluster having most common source nodes with the cluster, and assign each source node to a cluster having most edges with the cluster, to obtain at least two clusters after clustering;
[0191] a processing module configured to read feature information of nodes in the clusters after clustering corresponding to any convolutional layer in a training process of the graph convolutional network and store the feature information into a cache, and obtain an output result of the convolutional layer according to the feature information stored in the cache.
[0192] The specific implementation principles and effects of the apparatus provided by the embodiment of the present disclosure can be referred to the foregoing embodiments, and will not be described here.
[0193] The embodiment of the present disclosure further provides a graph data processing apparatus, comprising:
[0194] an acquisition module configured to acquire graph data to be processed;
[0195] a processing module configured to process the graph data based on a graph convolutional network to obtain a corresponding processing result, wherein the graph convolutional network is trained based on the graph convolutional network training method according to any one of the foregoing embodiments.
[0196] The specific implementation principles and effects of the apparatus provided by the embodiment of the present disclosure can be referred to the foregoing embodiments, and will not be described here.
[0197] FIG. 18 is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. As shown in FIG. 18, the electronic device of the present embodiment can comprise:
[0198] At least one processor 1801, and a memory 1802 connected with the at least one processor in communication; wherein the memory 1802 stores instructions executable by the at least one processor 1801, the instructions are executed by the at least one processor 1801 to make the electronic device perform the method of any of the above embodiments. Optionally, the memory 1802 can be independent, or integrated with the processor 1801.
[0199] The implementation principles and technical effects of the electronic device provided by the embodiments can be referred to the above embodiments, and will not be described here.
[0200] The embodiments of the present disclosure further provide a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, when the processor executes the computer-executable instructions, the method of any of the above embodiments is implemented.
[0201] The embodiments of the present disclosure further provide a computer program product, including a computer program, when the processor executes the computer program, the method of any of the above embodiments is implemented.
[0202] In several embodiments provided by the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and an actual implementation can be another division manner, for example, a plurality of modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0203] The integrated modules implemented in the form of software function modules can be stored in a computer readable storage medium. The software function modules stored in the storage medium include a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute part of the steps of the methods described in the embodiments of the present disclosure.
[0204] It should be appreciated that referenced processors above can be central processing units (CPUs), but can also be general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), or the like. A general-purpose processor can be a microprocessor, but there can be other processors as well such as a processor of the like. Steps of a method disclosed in conjunction with the application can be directly implemented in hardware, executed as software modules, or executed in a combination thereof. A memory can include a random access memory (RAM) and can further include a nonvolatile memory (NVM), e.g., at least one disk storage, and can be a Universal Serial Bus (USB) flash drive, a memory stick, a read-only memory, a magnetic or optical disk, or the like.
[0205] The storage medium can be implemented by any type of volatile or non-volatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically-erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, a magnetic or optical disk, or the like. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0206] An exemplary storage medium is coupled to the processor such that the processor can read information from, and write information to, the storage medium. Of course, the storage medium can be a part of the processor. Consistent with the teachings provided herein, the processor and the storage medium can be located in a special-purpose computing device. The special-purpose computing device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a server, a handheld computer, or the like.
[0207] It should be noted that, in this text, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or apparatus that includes a list of elements not only includes those elements, but also includes other elements not expressly listed, or inherent to such process, method, article or apparatus.
[0208] Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software plus the necessary general hardware platform, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of a software product in essence or in the part that contributes to the prior art. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods described in various embodiments of the present disclosure.
[0209] The above is only the preferred embodiment of the present disclosure, and does not limit the patent scope of the present disclosure, and any equivalent structure or equivalent process transformation made by using the content of the present disclosure specification and drawings, or directly or indirectly applied to other related technical fields, are also included in the patent protection scope of the present disclosure.
Claims
1. A method of training a graph convolutional network, wherein, The graph convolution network comprises at least one convolution layer for processing graph data comprising a plurality of nodes and edges between the nodes; the method comprises: For any convolution layer, determining a plurality of target nodes to be processed by the convolution layer, and source nodes of each target node, the target node being a node to be updated with feature information, and the source node of the target node being a node in the neighbor nodes of the target node for updating the feature information of the target node; Determining at least two center nodes from the plurality of target nodes, any center node corresponding to a cluster, and assigning the remaining target nodes other than the center nodes in the plurality of target nodes to the cluster having the most common source nodes with the cluster, and assigning each source node to the cluster having the most edges with the cluster, to obtain at least two clustered clusters; During the training process of the graph convolution network, reading the feature information of the nodes in the clustered cluster corresponding to any convolution layer, and storing the feature information in the cache, and obtaining the output result of the convolution layer according to the feature information stored in the cache.
2. The method of claim 1, wherein, Assigning the remaining target nodes other than the center nodes in the plurality of target nodes to the cluster having the most common source nodes with the cluster comprises: Determining at least one target node from the remaining target nodes other than the center nodes in the plurality of target nodes, for any target node in the at least one target node, comparing the neighbor mask of the target node with the cluster mask of each cluster to determine the cluster having the most common source nodes with the target node, and assigning the target node to the determined cluster; the neighbor mask is used to represent the source nodes of the target node, and the cluster mask is used to represent the source nodes of the target nodes in the cluster; Updating the cluster mask of the determined cluster according to the neighbor mask of the target node; In the case that there are target nodes not assigned to the cluster among the remaining target nodes other than the center nodes in the plurality of target nodes, the target nodes not assigned to the cluster are assigned in the same way as the step of comparing the neighbor mask of the target node with the cluster mask of each cluster, until the remaining target nodes other than the center nodes in the plurality of target nodes are all assigned to the cluster.
3. The method of claim 2, wherein, The neighbor mask and the cluster mask are represented by binary vectors, and the binary vector is a vector with zero or non-zero value elements; Comparing the neighbor mask of the target node with the cluster mask of each cluster to determine the cluster having the most common source nodes with the target node comprises: For any cluster, performing a logical OR operation on the neighbor mask of the target node and the cluster mask of the cluster, and performing a logical XOR operation on the result of the logical OR operation and the cluster mask of the cluster to obtain a comparison result; According to the comparison results of the target node and each cluster, the cluster corresponding to the comparison result with the least number of non-zero value elements in each comparison result is determined as the cluster having the most common source nodes with the target node.
4. The method of claim 2 or 3, wherein, updating a cluster mask of the determined cluster according to a neighbor mask of the target node, comprising: performing a logical OR operation on the neighbor mask of the target node and the cluster mask of the determined cluster, and determining a result of the logical OR operation as the cluster mask of the determined cluster.
5. The method according to any one of claims 1 to 4, wherein, determining at least two center nodes from the plurality of target nodes, comprising: determining a degree of each of the target nodes from the plurality of target nodes; determining, according to the degrees of each of the target nodes, at least two target nodes corresponding to the degrees in front of the order from large to small as the at least two center nodes.
6. The method according to any one of claims 1 to 5, wherein, allocating each source node to a cluster having the most edges with the cluster, comprising: for any source node, calculating the number of edges between the source node and target nodes in each cluster according to an adjacency matrix corresponding to the convolution layer, to obtain the number of edges between the source node and each cluster; allocating the source node to a cluster having the largest number of edges with the cluster according to the number of edges between the source node and each cluster.
7. The method according to any one of claims 1 to 6, wherein, when the number of convolution layers is multiple, the any convolution layer is the last convolution layer, after determining the cluster corresponding to the last convolution layer, the method further comprises: for other convolution layers except the last convolution layer, performing the following operations in reverse order in turn: taking the source nodes of the next convolution layer of the current convolution layer as the target nodes of the current convolution layer, and the clustering result of the target nodes of the current convolution layer inherits the clustering result of the source nodes of the next convolution layer; allocating the source nodes of the current convolution layer to the corresponding clusters to obtain the clusters corresponding to the current convolution layer.
8. The method of any one of claims 1-7, wherein, reading feature information of nodes in the clustered clusters corresponding to any convolution layer and storing the feature information into a cache according to the feature information stored in the cache to obtain an output result of the convolution layer, comprising: reading feature information of nodes in the clustered clusters corresponding to any convolution layer and storing the feature information into a cache, determining a weight matrix and an adjacency matrix to be calculated with the feature information; determining a multiplication order of the feature information, the weight matrix and the adjacency matrix according to a training strategy of the graph convolution network or the number of rows and columns of the adjacency matrix, and calculating the feature information, the weight matrix and the adjacency matrix according to the multiplication order to obtain the output result of the convolution layer.
9. The method of claim 8, wherein, when forward propagation, if the training strategy of the graph convolution network is full batch training, or if the training strategy is non-full batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, the multiplication order is: performing a product operation on the feature information and the weight matrix, and performing a product operation on the obtained product and the adjacency matrix; if the training strategy is non-full batch training and the number of rows of the adjacency matrix is less than the number of columns, the multiplication order is: performing a product operation on the adjacency matrix and the feature information, and performing a product operation on the obtained product and the weight matrix.
10. The method of claim 8 or 9, wherein, In back propagation, if the training strategy of the graph convolution network is full batch training, or if the training strategy is non-full batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, in the calculation of the partial derivative of the weight matrix, the corresponding multiplication order is: the partial derivative of the transpose matrix of the adjacency matrix and the result matrix is multiplied, and the obtained product is multiplied with the transpose matrix of the feature information, wherein the result matrix is a matrix obtained by multiplying the adjacency matrix, the feature information and the weight matrix in forward propagation; in the calculation of the partial derivative of the feature information, the corresponding multiplication order is: the partial derivative of the transpose matrix of the adjacency matrix and the result matrix is multiplied, and the obtained product is multiplied with the transpose matrix of the weight matrix; If the training strategy is non-full batch training and the number of rows of the adjacency matrix is less than the number of columns, in the calculation of the partial derivative of the weight matrix, the corresponding multiplication order is: the transpose matrix of the feature information and the transpose matrix of the adjacency matrix are multiplied, and the obtained product is multiplied with the partial derivative of the result matrix; in the calculation of the partial derivative of the feature information, the corresponding multiplication order is: the partial derivative of the result matrix and the transpose matrix of the weight matrix are multiplied, and the obtained product is multiplied with the transpose matrix of the adjacency matrix.
11. A graph data processing method, wherein, Comprising: Obtaining graph data to be processed; Processing the graph data based on a graph convolution network to obtain a corresponding processing result; wherein the graph convolution network is trained based on the method of any one of claims 1-10.
12. A graph convolutional network training apparatus, wherein, The graph convolution network comprises at least one convolution layer for processing graph data, the graph data comprising a plurality of nodes and edges between nodes; the device comprises: A determination module for determining, for any convolution layer, a plurality of target nodes to be processed by the convolution layer and source nodes of each target node, the target node being a node to be updated with feature information, and the source node of the target node being a node in the neighbor nodes of the target node for updating the feature information of the target node; An allocation module for determining at least two center nodes from the plurality of target nodes, any center node corresponding to a cluster, and allocating the remaining target nodes other than the center nodes in the plurality of target nodes to the cluster having the most common source nodes with the cluster, and allocating each source node to the cluster having the most edges with the cluster to obtain at least two clustered clusters; A processing module for reading the feature information of the nodes in the clustered clusters and storing it in a cache according to the clustered clusters corresponding to any convolution layer in the training process of the graph convolution network, and obtaining the output result of the convolution layer according to the feature information stored in the cache.
13. An electronic device, comprising: Comprising: At least one processor; And A memory connected in communication with the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method of any one of claims 1-11.
14. A computer readable storage medium, wherein, The computer readable storage medium stores computer executable instructions, and when the processor executes the computer executable instructions, the method of any one of claims 1-11 is implemented.
15. A computer program product, wherein, The computer program is executed by the processor to implement the method of any one of claims 1-11.
Citation Information
Patent Citations
Graph-based convolutional network training method, device and system
CN111445020A
Image clustering method and device, electronic equipment and computer readable storage medium
CN113255714A
Clustering method and device, electronic equipment and computer readable storage medium
CN114494753A
Data updating method and device, model training method and device, electronic equipment and medium
CN116595019A
Electronic device and control method thereof
US20210248181A1