Graph data processing method, system, device, and medium
By optimizing graph neural networks using resistive variable arrays and Hamiltonian loss functions, the efficiency problem of large-scale graph data processing is solved, achieving high-efficiency computation and scalability, and improving the training speed and stability of graph neural networks.
Patent Information
- Application Number
- CN202411894142.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2044-12-20
AI Technical Summary
Traditional methods struggle to efficiently process large-scale graph data. Training graph neural networks is complex and computationally expensive, making it difficult to support efficient parallel computing.
A resistive variable array is used to replace the adjacency matrix. By generating the node feature matrix and the resistive variable array, a graph neural network is used for weighted calculation, and the weight parameters are adjusted using the Hamiltonian loss function to achieve the training of the graph neural network.
It reduces energy consumption for data transport, decreases time overhead for graph data processing, improves computing speed and scalability, and enhances the robustness of neural networks.
Smart Images

Figure CN119739986B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of neural networks, and in particular to a graph data processing method, system, device, and medium. Background Technology
[0002] Graph Neural Networks (GNNs) are connection models that extract dependencies in a graph through information exchange between nodes. GNNs update the state of a node by accessing its neighbors at arbitrary depths, extending deep neural models to non-Euclidean domains. Therefore, GNNs have gained widespread attention and application in fields such as knowledge graphs, recommender systems, and biomedical engineering.
[0003] With the advent of the big data era, the scale of graph data structures has exploded, making traditional processing methods difficult.
[0004] Therefore, there is an urgent need for a graph data processing method that can accelerate computation to solve the above-mentioned technical problems. Summary of the Invention
[0005] Therefore, it is necessary to provide a graph data processing method, system, device, and medium to address the aforementioned technical problems.
[0006] Firstly, this application provides a graph data processing method, the method comprising:
[0007] Multiple graph data to be processed in the training dataset are processed to obtain node features and edge features;
[0008] Generate a node feature matrix and a resistive variable array based on node and edge features;
[0009] The first transition feature is generated based on the graph neural network, the node feature matrix, and the resistive variable array.
[0010] The first transition feature is input into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0011] The second transition feature is input into the pre-constructed readout network in the graph neural network to generate the result feature;
[0012] The weight parameters of the graph neural network are adjusted based on the characteristics of the results and the Hamiltonian loss function to train the graph neural network and obtain the target neural network.
[0013] The target result features are generated based on the node features, edge features, and target graph neural network of the target graph data.
[0014] In some embodiments, the method for generating a resistive switching array includes:
[0015] Create a two-dimensional matrix where the number of rows and columns matches the number of node features;
[0016] Traverse the edge features of the graph data to be processed and determine the target matrix element values that match the edge start and edge end points within the edge features;
[0017] Adjust the target matrix element values from the second preset value to the first preset value to generate an adjacency matrix that matches the graph data;
[0018] Based on the matrix element values in the adjacency matrix, the resistance state of the initial resistive array with the same size as the adjacency matrix is set to generate the resistive array.
[0019] In some embodiments, the resistive state of an initial resistive array of the same size as the adjacency matrix is set according to the matrix element values in the adjacency matrix to generate the resistive array, including:
[0020] In response to the detection of a matrix element value as a first preset value, the resistive storage cell at the intersection point in the initial resistive array that matches the matrix element value is set to a high-resistance state.
[0021] In response to the detection of a matrix element value as a second preset value, the resistive switching memory cell at the intersection point corresponding to the matrix element value in the initial resistive switching array is set to a low-resistance state.
[0022] In some embodiments, adjusting the weight parameters of the graph neural network based on the resulting features and the Hamiltonian loss function to train the graph neural network to obtain the target neural network includes:
[0023] Use an optimizer to adjust the weight parameters of the graph neural network to obtain result features that match the adjusted weight parameters;
[0024] The adjusted result features are input into the Hamiltonian loss function to obtain the Hamiltonian;
[0025] Determine whether the convergence condition is met based on the Hamiltonian and the number of iterations.
[0026] Upon detecting that the convergence condition is met, the training of the graph neural network is completed.
[0027] In some embodiments, the Hamiltonian loss function is:
[0028] Where p represents the result feature, i represents the number of rows, j represents the number of columns, and Q represents the constant matrix encoded by the actual problem solved by the graph neural network.
[0029] In some embodiments, when calculating the Hamiltonian based on the Hamiltonian loss function, the method includes:
[0030] In response to the detection of a negative number in the constant matrix, the constant matrix is split into a first constant submatrix and a second constant submatrix;
[0031] Replace the constant matrix in the Hamiltonian loss function with the first constant submatrix to calculate the first Hamiltonian to be processed;
[0032] Replace the constant matrix in the Hamiltonian loss function with a second constant submatrix to calculate the second Hamiltonian to be processed;
[0033] The first Hamiltonian to be processed and the second Hamiltonian to be processed are connected by a subtractor to synthesize a Hamiltonian.
[0034] In some embodiments, after generating an adjacency matrix that matches the graph data to be processed, the method further includes:
[0035] Generate a self-connected adjacency matrix from the sum of the identity matrix and the adjacency matrix;
[0036] Based on the matrix element values in the self-connected adjacency matrix, the resistance state of the initial resistive array is set to generate the resistive array.
[0037] Secondly, this application provides a graph data processing system, the system comprising:
[0038] The preprocessing module is used to process multiple graph data to be processed in the training dataset to obtain node features and edge features;
[0039] The preprocessing module is also used to generate a node feature matrix and a resistive variable array based on node features and edge features;
[0040] The first processing module is used to generate the first transition feature based on the graph neural network, the node feature matrix and the resistive array;
[0041] The first processing module is also used to input the first transition feature into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0042] The second processing module is used to input the second transition feature into the pre-built readout network in the graph neural network to generate the result feature;
[0043] The second processing module is also used to adjust the weight parameters of the graph neural network according to the result features and the Hamiltonian loss function, so as to train the graph neural network to obtain the target neural network.
[0044] The result generation module is used to generate target result features based on the node features, edge features, and target graph neural network of the target graph data.
[0045] Thirdly, this application provides a computer program product, wherein when the computer program is executed by a processor, it implements the following method steps:
[0046] Multiple graph data to be processed in the training dataset are processed to obtain node features and edge features;
[0047] Generate a node feature matrix and a resistive variable array based on node and edge features;
[0048] The first transition feature is generated based on the graph neural network, the node feature matrix, and the resistive variable array.
[0049] The first transition feature is input into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0050] The second transition feature is input into the pre-constructed readout network in the graph neural network to generate the result feature;
[0051] The weight parameters of the graph neural network are adjusted based on the characteristics of the results and the Hamiltonian loss function to train the graph neural network and obtain the target neural network.
[0052] The target result features are generated based on the node features, edge features, and target graph neural network of the target graph data.
[0053] Fourthly, this application provides an electronic device, which includes:
[0054] One or more processors;
[0055] and memory associated with one or more processors, the memory being used to store program instructions, which, when read and executed by one or more processors, perform the following operations:
[0056] Multiple graph data to be processed in the training dataset are processed to obtain node features and edge features;
[0057] Generate a node feature matrix and a resistive variable array based on node and edge features;
[0058] The first transition feature is generated based on the graph neural network, the node feature matrix, and the resistive variable array.
[0059] The first transition feature is input into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0060] The second transition feature is input into the pre-constructed readout network in the graph neural network to generate the result feature;
[0061] The weight parameters of the graph neural network are adjusted based on the characteristics of the results and the Hamiltonian loss function to train the graph neural network and obtain the target neural network.
[0062] The target result features are generated based on the node features, edge features, and target graph neural network of the target graph data.
[0063] Fifthly, this application also provides a computer-readable storage medium storing a computer program that causes a computer to perform the following operations:
[0064] Multiple graph data to be processed in the training dataset are processed to obtain node features and edge features;
[0065] Generate a node feature matrix and a resistive variable array based on node and edge features;
[0066] The first transition feature is generated based on the graph neural network, the node feature matrix, and the resistive variable array.
[0067] The first transition feature is input into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0068] The second transition feature is input into the pre-constructed readout network in the graph neural network to generate the result feature;
[0069] The weight parameters of the graph neural network are adjusted based on the characteristics of the results and the Hamiltonian loss function to train the graph neural network and obtain the target neural network.
[0070] The target result features are generated based on the node features, edge features, and target graph neural network of the target graph data.
[0071] The beneficial effects achieved by this application are as follows:
[0072] This application provides a graph data processing method, including processing multiple graph data to be processed in a training dataset to obtain node features and edge features; generating a node feature matrix and a resistive array based on the node features and edge features; generating a first transition feature based on the graph neural network, the node feature matrix, and the resistive array; inputting the first transition feature into one or more graph convolutional layers in the graph neural network for weighted calculation to output a second transition feature; inputting the second transition feature into a pre-constructed readout network in the graph neural network to generate a result feature; adjusting the weight parameters of the graph neural network based on the result feature and the Hamiltonian loss function to train the graph neural network to obtain a target neural network; and generating a target result feature based on the node features, edge features, and target graph neural network of the target graph data. Using the resistive array as the adjacency matrix of the graph neural network reduces the energy consumption of data transport in traditional architectures, reduces the time overhead required for graph data computation, and is highly efficient and scalable, while accelerating the neural network algorithm. Attached Figure Description
[0073] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein:
[0074] Figure 1 This is a schematic diagram of a graph data processing method provided in an embodiment of this application;
[0075] Figure 2 This is a schematic diagram of a resistive switching array structure provided in an embodiment of this application;
[0076] Figure 3 This is a schematic diagram of the electrical characteristics of a binary resistive switching memory provided in an embodiment of this application;
[0077] Figure 4 This is a schematic diagram of a maximum independent set problem provided in an embodiment of this application;
[0078] Figure 5 This is a schematic diagram of the image and adjacency matrix of digital image 2 provided in an embodiment of this application;
[0079] Figure 6 This is a schematic diagram of a graph data processing system architecture provided in an embodiment of this application;
[0080] Figure 7 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0081] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0082] It should be understood that, in the description of this application, unless the context explicitly requires it, the words "comprising," "including," and similar terms throughout the specification and claims should be interpreted as encompassing rather than being exclusive or exhaustive; that is, meaning "including but not limited to."
[0083] It should also be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0084] It should be noted that the terms "S1," "S2," etc., are used only for descriptive purposes and do not specifically refer to the order or sequence, nor are they intended to limit this application. They are merely for the convenience of describing the method of this application and should not be construed as indicating the sequential order of the steps. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0085] As mentioned in the background, traditional deep learning methods have achieved great success in feature extraction from Euclidean space data. However, many real-world applications use data generated from non-Euclidean space data. Traditional deep learning methods perform poorly in handling non-Euclidean space data. Convolutional neural networks (CNNs) can only process Euclidean data, such as two-dimensional images and one-dimensional text data. These data represent special cases of knowledge graph structures, making CNNs difficult to apply to general graph structures. Graph neural networks, on the other hand, can update the state of a node by accessing its neighbors at any depth, thus extending deep neural network models to non-Euclidean domains. With the advent of the big data era, the scale of graph data structures has exploded. For example, Alibaba's user and product graph contains over one billion users and two billion products; YouTube's social network of users contains 11,384,899 nodes and 2,990,443 edges; similar large-scale graphs contain billions of nodes and trillions of edges, consuming enormous amounts of content.
[0086] Furthermore, training GNNs is inherently complex and very expensive in terms of memory and computation, making it difficult to support efficient and scalable parallel computing. Therefore, there is an urgent need for a new processing method to handle graph data in order to address the challenges faced by graph neural networks.
[0087] Example 1
[0088] This application provides a graph data processing method, specifically, as shown in the embodiments below. Figure 1 As shown, it includes the following:
[0089] S1. Process multiple graph data to be processed in the training dataset to obtain node features and edge features.
[0090] Graph data is a data structure used to represent complex relationships between entities, typically composed of nodes and edges. Nodes represent entities, and edges represent the relationships between nodes. The node features can be directly extracted from the node attribute information contained in the graph data, such as age and gender of users in a social network. These attributes can be directly used as node features. Alternatively, node features reflecting the local or global structural characteristics of nodes can be constructed using methods such as clustering coefficients or K-kernel decomposition. This application does not limit the specific methods for obtaining node features. The edge features can be directly extracted from the edge attribute information contained in the graph data, representing the relationships between nodes; or they can be generated by combining the features of two nodes. For example, this can be done by simply concatenating the feature vectors of two nodes, or by calculating their distance, similarity, etc. This application does not limit the specific methods for obtaining edge features. The graph data to be processed is data from the training dataset used to train the graph neural network.
[0091] S2. Generate a node feature matrix and a resistive variable array based on node features and edge features.
[0092] The node feature matrix is a matrix generated based on node features. The node features are converted into numerical form using one-hot encoding or embedding layers based on the existing node features; this will not be elaborated further in this application.
[0093] The specific method for obtaining the aforementioned resistive variable array includes: creating a two-dimensional matrix, wherein the number of rows and columns of the two-dimensional matrix matches the number of node features; traversing the edge features contained in the graph data to be processed, and determining the target matrix element values that match the edge start and edge end points within the edge features based on the information contained in the edge features; adjusting the target matrix element values from a second preset value to a first preset value to generate an adjacency matrix that matches the graph data; and setting the resistance value state of an initial resistive variable array with the same size as the adjacency matrix based on the matrix element values within the adjacency matrix to generate the resistive variable array. This application, by utilizing the similarity between the resistive variable array and the adjacency matrix, uses the resistive variable array to replace the adjacency matrix when inputting into a graph neural network to realize the input of relevant features of the edges in the graph structure, thus broadening the application path of the resistive variable array in neural network computation and further accelerating the neural network algorithm.
[0094] It is understandable that the resistive random access array is actually a crossbar array based on a binary resistive random access memory, and the structure of the resistive random access array is as follows: Figure 2 As shown, it consists of multiple memory cells, and the electrical characteristics of a single memory cell at the intersection are as follows: Figure 3 As shown. During the forward voltage scan, the device transitions from a high-impedance state to a low-impedance state (i.e., the SET process). Under the subsequent reverse positive voltage scan, the memory cell remains in the low-impedance state until the voltage polarity reverses. Under a negative bias voltage, the memory cell returns to the high-impedance state (i.e., the RESET process); this demonstrates the non-volatile characteristics of the binary resistive random access memory (RRAM). In the RRAM array, a positive voltage from row to column causes a SET operation on the device, while a positive voltage from column to row drives a RESET operation. Selected rows perform read and write operations under different bias voltages, while other unselected rows and columns remain at half the bias voltage.
[0095] The above-described method of generating a resistive array by setting the resistance state of an initial resistive array of the same size as the adjacency matrix based on the matrix element values in the adjacency matrix includes: in response to detecting a matrix element value of a first preset value, setting the resistive storage cell at the intersection point in the initial resistive array that matches the matrix element value to a high-resistance state; and in response to detecting a matrix element value of a second preset value, setting the resistive storage cell at the intersection point in the initial resistive array that corresponds to the matrix element value to a low-resistance state. The specific process for setting the high-resistance and low-resistance states has been explained above. Preferably, the first preset value is set to 1, and the second preset value is preferably set to 0. However, these settings can be modified, and this application does not limit this modification.
[0096] Furthermore, to enhance the ability to retain information in the matrix pairs, prevent information loss, improve the robustness of subsequent graph neural networks, and simplify computation, this application proposes, after generating an adjacency matrix that matches the graph data to be processed, to generate a self-connected adjacency matrix based on the sum of the identity matrix and the adjacency matrix, as expressed by the formula: Where I is the identity matrix and A is the adjacency matrix. It is a self-connected adjacency matrix. Based on the matrix element values in the self-connected adjacency matrix, the resistance state of the initial resistive array is set to generate the resistive array; the specific setting method is the same as that mentioned above for setting the resistance state of the initial resistive array based on the adjacency matrix, and this application does not limit it.
[0097] S3. Generate the first transition feature based on the graph neural network, node feature matrix, and resistive array.
[0098] It is understandable that the node feature matrix is a matrix formed by combining the feature vectors of all nodes, and the node feature matrix is converted into voltage amplitude after random initialization. The resistive variable array is obtained through adjacency matrix mapping to represent the characteristics of edges within the graph structure. The aforementioned first transition feature is the output current vector obtained by multiplying the matrix vector of the resistive variable array and the matrix vector of the node feature matrix.
[0099] S4. Input the first transition feature into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature.
[0100] Graph neural networks typically include one or more graph convolutional layers to update the representation of the current node by aggregating information from neighboring nodes. For each layer, the new representation of a node is obtained by combining its own features with those of its neighboring nodes. The aforementioned first transitional features are input into the graph convolutional layer and subjected to weighted processing. The graph convolution formula is typically expressed as: Among them, W (l) H represents the weight matrix of the l-th layer. (l) H represents the feature matrix of the nodes in the l-th layer. (l+1) Let represent the weight matrix of the (l+1)th layer, and softmax represent the activation function.
[0101] In this application, the weights of the weight matrix can be mapped to the conductance values of the corresponding cross-point storage cells in the resistive array of the weight storage and calculation module. A corresponding read voltage is applied to all rows of the resistive array. Weighted summation is achieved by multiplying the read voltage by each conductance value in the resistive array. The current value after weighted summation is output from the corresponding column. The entire weighted summation process can be expressed by the following matrix operation formula:
[0102]
[0103] Among them, G nm V represents the conductance value of each crossover storage cell device in the resistive variable array. m This represents the read voltage, i.e., the weight, I. nThis represents the output current amplitude after weighted summation, i.e., the second transient characteristic. Weighted calculation of the resistive variable array is achieved by applying a reading voltage, further improving the calculation speed.
[0104] S5. Input the second transition feature into the pre-built readout network in the graph neural network to generate the result feature.
[0105] After normalizing the second transition feature, it is input into a pre-constructed readout network. The readout network selects an appropriate readout mechanism based on the specific task requirements, generating the final output according to the task needs, such as node classification, graph classification, and link prediction. For node-level tasks, the node representation of the last layer is used directly; for graph-level tasks, the representations of all nodes need to be aggregated, such as by averaging or max pooling. The readout network typically uses fully connected layers or other classification / regression layers to generate prediction results (i.e., outcome features).
[0106] S6. Adjust the weight parameters of the graph neural network according to the result characteristics and Hamiltonian loss function to train the graph neural network and obtain the target neural network.
[0107] Specifically, an optimizer is used to adjust the weight parameters of the graph neural network to obtain result features that match the adjusted weight parameters; the adjusted result features are input into the Hamiltonian loss function to obtain the Hamiltonian; based on the Hamiltonian and the number of iterations, it is determined whether the convergence condition is met, i.e., whether the Hamiltonian is at its minimum or the number of iterations has reached the set maximum. If the Hamiltonian is at its minimum or the number of iterations has reached the maximum, the convergence condition is considered met; in response to the detection that the convergence condition is met, the training of the graph neural network is completed. This application chooses the Hamiltonian loss function as the loss function of the graph neural network to further accelerate the training speed of the graph neural network, prevent the network parameters from overfitting the training data, and further improve the stability of the graph neural network, especially in the case of small samples or a lot of noise.
[0108] The aforementioned optimizers include gradient descent optimizers, stochastic gradient descent optimizers, mini-batch gradient descent optimizers, momentum optimizers, and Adam (Adaptive Moment Estimation) optimizers, etc., and this application does not limit the specific optimizers used. Parameter tuning is a conventional technique in the art and will not be elaborated upon here.
[0109] The Hamiltonian loss function is: p represents the result feature, i represents the number of rows, j represents the number of columns, and Q represents the constant matrix encoded by the actual problem solved by the graph neural network. When calculating the Hamiltonian based on the Hamiltonian loss function, since conductance is usually an integer, negative numbers cannot be directly mapped. Therefore, the matrix needs to be split. This application also proposes, in response to the detection of negative numbers in the constant matrix, splitting the constant matrix into a first constant submatrix and a second constant submatrix; replacing the constant matrix in the Hamiltonian loss function with the first constant submatrix to calculate the first Hamiltonian to be processed; replacing the constant matrix in the Hamiltonian loss function with the second constant submatrix to calculate the second Hamiltonian to be processed; and using a subtractor to connect the first and second Hamiltonians to be processed to synthesize the Hamiltonian. It is understood that the aforementioned constant matrix, the first constant submatrix, and the second constant submatrix can all be mapped to a resistive variable array for storage and retrieval.
[0110] S7. Generate target result features based on the node features, edge features, and target graph neural network of the target graph data.
[0111] After training, a test sample consisting of data not in the training dataset is used to test the recognition accuracy; and once the accuracy reaches a preset threshold, the target graph neural network is put into use. The target graph neural network is then used to process the target graph data for classification or prediction, etc.
[0112] This application proposes using a resistive variable array as the adjacency matrix of a graph neural network, which reduces the energy consumption of data transport in traditional architectures, reduces the time overhead required for large-scale data computation, and has high efficiency and scalability, while accelerating neural network algorithms.
[0113] Understandably, the graph neural network implemented above can be used to solve various problems. For example, in the specific implementation scenario of solving combinatorial optimization problems, taking the maximum independent set problem as an example, a subset I of the vertex set of a graph G is called an independent set of graph G, which means that any two vertices in I are not connected by an edge. The independent set with the largest number of vertices in graph G is called the maximum independent set of graph G. The MIS problem is a typical NP-hard problem. Taking a graph with four vertices and four edges as an example, assuming that each edge between nodes has the same weight, the specific structure of the graph and the adjacency matrix are as follows: Figure 4As shown, a 4x4 array is used to represent the graph, and the connections of the nodes are mapped to the conductance of the resistive array. Specifically, voltage is written to the row input and grounded to the column, with the corresponding conductance value written. As an unsupervised node classification task, the maximum independent set problem does not require any labeled data. The input node feature vector is randomly initialized and converted into the voltage amplitude applied to the array. After the output current is normalized, it is multiplied by the matrix vector based on the resistive array to obtain the output current vector. The output classification probability (p) is obtained through the readout network, where p∈[0,1]. Then, the output soft probability is used as the result feature input into the Hamiltonian-based loss function. In a specific example, the constant matrix Q generated after encoding the actual problem to be solved is defined as:
[0114]
[0115] At this point, the constant matrix Q containing negative numbers is split to obtain the first constant submatrix Q1 and the second constant submatrix Q2.
[0116] Two 4x4 resistive variable arrays can be used as Q1 and Q2. The outputs are concatenated using a subtractor to obtain the final result. After training, the obtained soft probability P is mapped back to a binary integer variable representing the classification result, thus successfully classifying the four nodes into two classes and obtaining the maximum set. The mapping formula is as follows:
[0117]
[0118] In digital image recognition tasks, the adjacency matrix for each digital image is first obtained. This matrix represents the connection relationships between different pixels in the image. A value of 1 indicates that two pixels are connected, while a value of 0 indicates that two pixels are not connected. Let's take the number 2 as an example. Figure 5 An image of the digit 2 consisting of 3*5 pixels and its corresponding adjacency matrix. The values of the adjacency matrix, with added self-connections, are mapped to a 15*15 binary resistive array. For different digital images, the input node feature vector is different, representing the grayscale of each pixel. Specifically, in... Figure 5 In the diagram, white represents 0 and gray represents 1. Different pixel values are generated for different digital images, and these values are then converted into voltage signals and applied to the rows of the resistive array. Subsequently, the second transition feature, obtained by weighting the corresponding resistive array and node feature vectors, is input into the readout network for training and classification.
[0119] Example 2
[0120] Corresponding to Embodiment 1 and Embodiment 2 above, as Figure 6 As shown in the illustration, this application also provides a graph data processing system, including:
[0121] The preprocessing module 610 is used to process multiple graph data to be processed in the training dataset to obtain node features and edge features;
[0122] The preprocessing module 610 is also used to generate a node feature matrix and a resistive variable array based on node features and edge features;
[0123] The first processing module 620 is used to generate a first transition feature based on the graph neural network, the node feature matrix and the resistive array.
[0124] The first processing module 620 is further configured to input the first transition feature into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0125] The second processing module 630 is used to input the second transition feature into the pre-built readout network in the graph neural network to generate the result feature;
[0126] The second processing module 630 is also used to adjust the weight parameters of the graph neural network according to the result features and the Hamiltonian loss function, so as to train the graph neural network to obtain the target neural network.
[0127] The result generation module 640 is used to generate target result features based on the node features, edge features, and target graph neural network of the target graph data.
[0128] In some implementation scenarios, the preprocessing module 610 is also used to create a two-dimensional matrix, wherein the number of rows and columns of the two-dimensional matrix matches the number of node features; traverse the edge features of the graph data to be processed, determine the target matrix element values that match the edge start and edge end points within the edge features; adjust the target matrix element values from a second preset value to a first preset value to generate an adjacency matrix that matches the graph data; and, based on the matrix element values within the adjacency matrix, set the resistance state of an initial resistive variable array with the same size as the adjacency matrix to generate the resistive variable array.
[0129] In some implementation scenarios, the second processing module 630 is also used to, in response to detecting that the matrix element value is a first preset value, set the resistive variable storage cell at the intersection point in the initial resistive variable array that matches the matrix element value to a high-resistance state; and in response to detecting that the matrix element value is a second preset value, set the resistive variable storage cell at the intersection point in the initial resistive variable array that corresponds to the matrix element value to a low-resistance state.
[0130] In some implementation scenarios, the second processing module 630 is further used to adjust the weight parameters of the graph neural network using an optimizer to obtain result features that match the adjusted weight parameters; input the adjusted result features into the Hamiltonian loss function to obtain the Hamiltonian; determine whether the convergence condition is met based on the Hamiltonian and the number of iterations; and complete the training of the graph neural network in response to the detection that the convergence condition is met. The Hamiltonian loss function is as follows: Where p represents the result feature, i represents the number of rows, j represents the number of columns, and Q represents the constant matrix encoded by the actual problem solved by the graph neural network.
[0131] In some implementation scenarios, the second processing module 630 is also used to calculate the Hamiltonian based on the Hamiltonian loss function, the method including: in response to detecting the presence of negative numbers in the constant matrix, splitting the constant matrix into a first constant submatrix and a second constant submatrix; replacing the constant matrix in the Hamiltonian loss function with the first constant submatrix to calculate the first Hamiltonian to be processed; replacing the constant matrix in the Hamiltonian loss function with the second constant submatrix to calculate the second Hamiltonian to be processed; and using a subtractor to connect the first Hamiltonian to be processed and the second Hamiltonian to be processed to synthesize the Hamiltonian.
[0132] In some implementation scenarios, the preprocessing module 610 is also used to generate a self-connected adjacency matrix based on the sum of the identity matrix and the adjacency matrix; and to set the resistance state of the initial resistive array based on the matrix element values in the self-connected adjacency matrix to generate the resistive array.
[0133] Example 3
[0134] Corresponding to all the above embodiments, this application provides a computer program product, wherein when the computer program is executed by a processor, it implements the following method steps:
[0135] Multiple graph data to be processed in the training dataset are processed to obtain node features and edge features;
[0136] Generate a node feature matrix and a resistive variable array based on node and edge features;
[0137] The first transition feature is generated based on the graph neural network, the node feature matrix, and the resistive variable array.
[0138] The first transition feature is input into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0139] The second transition feature is input into the pre-constructed readout network in the graph neural network to generate the result feature;
[0140] The weight parameters of the graph neural network are adjusted based on the characteristics of the results and the Hamiltonian loss function to train the graph neural network and obtain the target neural network.
[0141] The target result features are generated based on the node features, edge features, and target graph neural network of the target graph data.
[0142] In some implementation scenarios, when a computer program is executed by a processor, it also performs the following steps:
[0143] Create a two-dimensional matrix where the number of rows and columns matches the number of node features;
[0144] Traverse the edge features of the graph data to be processed and determine the target matrix element values that match the edge start and edge end points within the edge features;
[0145] Adjust the target matrix element values from the second preset value to the first preset value to generate an adjacency matrix that matches the graph data;
[0146] Based on the matrix element values in the adjacency matrix, the resistance state of the initial resistive array with the same size as the adjacency matrix is set to generate the resistive array.
[0147] In some implementation scenarios, when a computer program is executed by a processor, it also performs the following steps:
[0148] In response to the detection of a matrix element value as a first preset value, the resistive storage cell at the intersection point in the initial resistive array that matches the matrix element value is set to a high-resistance state.
[0149] In response to the detection of a matrix element value as a second preset value, the resistive switching memory cell at the intersection point corresponding to the matrix element value in the initial resistive switching array is set to a low-resistance state.
[0150] In some implementation scenarios, when a computer program is executed by a processor, it also performs the following steps:
[0151] Use an optimizer to adjust the weight parameters of the graph neural network to obtain result features that match the adjusted weight parameters;
[0152] The adjusted result features are input into the Hamiltonian loss function to obtain the Hamiltonian;
[0153] Determine whether the convergence condition is met based on the Hamiltonian and the number of iterations.
[0154] Upon detecting that the convergence condition is met, the training of the graph neural network is completed.
[0155] The Hamiltonian loss function is:
[0156] Where p represents the result feature, i represents the number of rows, j represents the number of columns, and Q represents the constant matrix encoded by the actual problem solved by the graph neural network.
[0157] In some implementation scenarios, when a computer program is executed by a processor, it also performs the following steps:
[0158] In response to the detection of a negative number in the constant matrix, the constant matrix is split into a first constant submatrix and a second constant submatrix;
[0159] Replace the constant matrix in the Hamiltonian loss function with the first constant submatrix to calculate the first Hamiltonian to be processed;
[0160] Replace the constant matrix in the Hamiltonian loss function with a second constant submatrix to calculate the second Hamiltonian to be processed;
[0161] The first Hamiltonian to be processed and the second Hamiltonian to be processed are connected by a subtractor to synthesize a Hamiltonian.
[0162] In some implementation scenarios, when a computer program is executed by a processor, it also performs the following steps:
[0163] Generate a self-connected adjacency matrix from the sum of the identity matrix and the adjacency matrix;
[0164] Based on the matrix element values in the self-connected adjacency matrix, the resistance state of the initial resistive array is set to generate the resistive array.
[0165] Example 4
[0166] Corresponding to all the above embodiments, this application provides an electronic device, including: one or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions, which, when read and executed by the one or more processors, perform the following operations:
[0167] Multiple graph data to be processed in the training dataset are processed to obtain node features and edge features;
[0168] Generate a node feature matrix and a resistive variable array based on node and edge features;
[0169] The first transition feature is generated based on the graph neural network, the node feature matrix, and the resistive variable array.
[0170] The first transition feature is input into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0171] The second transition feature is input into the pre-constructed readout network in the graph neural network to generate the result feature;
[0172] The weight parameters of the graph neural network are adjusted based on the characteristics of the results and the Hamiltonian loss function to train the graph neural network and obtain the target neural network.
[0173] The target result features are generated based on the node features, edge features, and target graph neural network of the target graph data.
[0174] in, Figure 7 An exemplary architecture of an electronic device is shown, which may include a processor 710, a video display adapter 711, a disk drive 712, an input / output interface 713, a network interface 714, and a memory 720. The processor 710, video display adapter 711, disk drive 712, input / output interface 713, network interface 714, and memory 720 can communicate with each other via a bus 730.
[0175] The processor 710 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to achieve the technical solution provided in this application.
[0176] The memory 720 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 720 can store the operating system 721 for controlling the execution of the electronic device 700, and the basic input / output system (BIOS) 722 for controlling the low-level operations of the electronic device 700. Additionally, it can store a web browser 723, a data storage management system 724, and an icon font processing system 725, etc. The aforementioned icon font processing system 725 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when the technical solution provided in this application is implemented through software or firmware, the relevant program code is stored in the memory 720 and is called and executed by the processor 710.
[0177] Input / output interface 713 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.
[0178] Network interface 714 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0179] Bus 730 includes a pathway for transmitting information between various components of the device, such as processor 710, video display adapter 711, disk drive 712, input / output interface 713, network interface 714, and memory 720.
[0180] In addition, the electronic device 700 can also obtain information on specific claim conditions from the virtual resource object claim condition information database for use in condition judgment, etc.
[0181] It should be noted that although the above-described device only shows the processor 710, video display adapter 711, disk drive 712, input / output interface 713, network interface 714, memory 720, bus 730, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.
[0182] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, a cloud server, or a network device, etc.) to execute the methods of various embodiments or some parts of the embodiments of this application.
[0183] Example 5
[0184] Corresponding to all the above embodiments, this application also provides a computer-readable storage medium storing a computer program that causes a computer to perform the following operations:
[0185] Multiple graph data to be processed in the training dataset are processed to obtain node features and edge features;
[0186] Generate a node feature matrix and a resistive variable array based on node and edge features;
[0187] The first transition feature is generated based on the graph neural network, the node feature matrix, and the resistive variable array.
[0188] The first transition feature is input into one or more graph convolutional layers in the graph neural network for weighted calculation to output the second transition feature;
[0189] The second transition feature is input into the pre-constructed readout network in the graph neural network to generate the result feature;
[0190] The weight parameters of the graph neural network are adjusted based on the characteristics of the results and the Hamiltonian loss function to train the graph neural network and obtain the target neural network.
[0191] The target result features are generated based on the node features, edge features, and target graph neural network of the target graph data.
[0192] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0193] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A graph data processing method, characterized in that, The method includes: Multiple graph data to be processed in the training dataset are processed to obtain node features and edge features; Generate a node feature matrix and a resistive variable array based on the node features and edge features; The first transition feature is generated based on the graph neural network, the node feature matrix, and the resistive variable array. The first transition feature is input into one or more graph convolutional layers in a graph neural network for weighted calculation to output the second transition feature; The second transition feature is input into a pre-constructed readout network in the graph neural network to generate the result feature; The weight parameters of the graph neural network are adjusted based on the resulting features and the Hamiltonian loss function to train the graph neural network and obtain the target neural network. The target result features are generated based on the node features and edge features of the target graph data and the target graph neural network. The method for generating the resistive array includes: Create a two-dimensional matrix, wherein the number of rows and columns of the two-dimensional matrix matches the number of node features; Traverse the edge features of the graph data to be processed, and determine the target matrix element values that match the edge start and edge end points within the edge features; The element values of the target matrix are adjusted from the second preset value to the first preset value to generate an adjacency matrix that matches the graph data; Based on the matrix element values in the adjacency matrix, set the resistance state of the initial resistive array with the same size as the adjacency matrix to generate the resistive array; The step of setting the resistance state of an initial resistive array with the same size as the adjacency matrix based on the matrix element values in the adjacency matrix to generate the resistive array includes: In response to detecting that the matrix element value is a first preset value, the resistive switching memory cell at the intersection point in the initial resistive switching array that matches the matrix element value is set to a high-resistivity state; In response to detecting that the matrix element value is a second preset value, the resistive switching memory cell at the intersection point corresponding to the matrix element value in the initial resistive switching array is set to a low-resistance state.
2. The method according to claim 1, characterized in that, The step of adjusting the weight parameters of the graph neural network based on the resulting features and the Hamiltonian loss function to train the graph neural network and obtain the target neural network includes: Use an optimizer to adjust the weight parameters of the graph neural network to obtain result features that match the adjusted weight parameters; The adjusted result features are input into the Hamiltonian loss function to obtain the Hamiltonian; Determine whether the convergence condition is met based on the Hamiltonian and the number of iterations. Upon detecting that the convergence condition is met, the training of the graph neural network is completed.
3. The method according to claim 2, characterized in that, The Hamiltonian loss function is: ; in, Indicates the characteristics of the result. i Indicates the row number. j Indicates the column number. Q This represents a constant matrix that encodes the actual problem solved by the graph neural network.
4. The method according to claim 3, characterized in that, When calculating the Hamiltonian based on the Hamiltonian loss function, the method includes: In response to the detection of a negative number in the constant matrix, the constant matrix is split into a first constant submatrix and a second constant submatrix; Replace the constant matrix in the Hamiltonian loss function with a first constant submatrix to calculate the first Hamiltonian to be processed; Replace the constant matrix in the Hamiltonian loss function with a second constant submatrix to calculate the second Hamiltonian to be processed; The first Hamiltonian to be processed and the second Hamiltonian to be processed are connected by a subtractor to synthesize a Hamiltonian.
5. The method according to claim 1, characterized in that, After generating an adjacency matrix that matches the graph data to be processed, the method further includes: Generate a self-connected adjacency matrix from the sum of the identity matrix and the adjacency matrix; Based on the matrix element values in the self-connected adjacency matrix, the resistance state of the initial resistive array is set to generate the resistive array.
6. A graph data processing system for implementing the graph data processing method as described in claim 1, characterized in that, The system includes: The preprocessing module is used to process multiple graph data to be processed in the training dataset to obtain node features and edge features; The preprocessing module is also used to generate a node feature matrix and a resistive variable array based on the node features and edge features; The first processing module is used to generate a first transition feature based on the graph neural network, the node feature matrix, and the resistive array. The first processing module is further configured to input the first transition feature into one or more graph convolutional layers in a graph neural network for weighted calculation to output the second transition feature; The second processing module is used to input the second transition feature into a pre-built readout network in the graph neural network to generate the result feature; The second processing module is further configured to adjust the weight parameters of the graph neural network according to the result features and the Hamiltonian loss function, so as to train the graph neural network to obtain the target neural network. The result generation module is used to generate target result features based on the node features, edge features, and target graph neural network of the target graph data.
7. An electronic device, characterized in that, The electronic device includes: One or more processors; And a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the method of any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, It stores a computer program that causes the computer to perform the method described in any one of claims 1-5.
Citation Information
Patent Citations
Graph neural network calculation method and device based on resistive random access memory
CN114186598A
Methods and devices for continuous time quantum computing
WO2023169680A1