Data classification method and related device

The quantum neural network addresses the challenge of utilizing distant past information in sequence data classification by propagating and storing feature data across nodes, thereby enhancing classification accuracy.

CN116257668BActive Publication Date: 2025-07-15ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111495061.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-08
Publication Date
2025-07-15
Estimated Expiration
2041-12-08

AI Technical Summary

Technical Problem

When existing neural networks process interrelated sequence data, it is difficult to effectively utilize the previous information with far distances, resulting in a reduced classification accuracy.

Method used

The quantum neural network is adopted to use the cascading classification nodes and quantum logic gate structures to memorize the characteristic data of the second target state using the first qubit and pass it between different nodes. The quantum neural network is trained in combination with the synchronous perturbation random approximation algorithm to optimize parameters to improve classification accuracy.

Benefits of technology

Effectively using the previous information with a long distance has improved the accuracy of data classification and enhanced the classification capabilities of quantum neural networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257668B_ABST
    Figure CN116257668B_ABST
Patent Text Reader

Abstract

The present invention discloses a data classification method and related devices. The method includes: obtaining data to be classified, preparing the quantum state of a first qubit to a first target state, and preparing the quantum state of a second qubit to a second target state representing the data to be classified; inputting the first target state and the second target state into a quantum neural network, the quantum neural network including a plurality of cascaded classification nodes, the input of the initial classification node among the plurality of cascaded classification nodes being the first target state and the second target state, and the input of the classification nodes other than the initial classification node among the plurality of cascaded classification nodes being the second target state and the quantum state of the first qubit output by the previous classification node; measuring the second qubit to obtain the output result of the quantum neural network, and converting the output result into a classification result. Through this technical solution, sequential data with front-back correlation can be classified, and the classification accuracy can be improved by using the previous data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of quantum computing, and particularly relates to a data classification method and related devices. Background Art

[0002] For correlated sequence data, some neural networks such as Long Short Term Memory (LSTM) can remember the information of the previous text, and then classify the data according to the correlated information to improve the classification effect. For example, for a sentence like "I eat", a verb is generally followed by a noun rather than a verb after "eat", and the Long Short Term Memory network can use such a rule to improve the accuracy of classification prediction.

[0003] In related technologies, some types of neural networks include multiple hidden layers. When the number of hidden layers is large, the information of the previous text is difficult to remember, and thus the information of the previous text that is far apart cannot be effectively utilized, resulting in a decrease in the accuracy of its classification. Based on this, a data classification method and related devices are proposed. Summary of the Invention

[0004] The purpose of the present invention is to provide a data classification method and related devices, aiming to effectively utilize the information of the previous text that is far apart when classifying and predicting correlated sequence data, and improve the accuracy of classification prediction.

[0005] To achieve the above purpose, in the first aspect of the embodiments of the present invention, a data classification method is provided. The method includes:

[0006] Obtain data to be classified, prepare the quantum state of the first qubit to a first target state, and prepare the quantum state of the second qubit to a second target state representing the data to be classified;

[0007] Input the first target state and the second target state into a quantum neural network. The quantum neural network includes a plurality of cascaded classification nodes. The input of the initial classification node in the plurality of cascaded classification nodes is the first target state and the second target state, and the input of the classification nodes other than the initial classification node in the plurality of cascaded classification nodes is the second target state and the quantum state of the first qubit output by the previous classification node;

[0008] Measure the second qubit to obtain the output result of the quantum neural network, and convert the output result into a classification result.

[0009] Optionally, the classification node includes an optimization layer, and the optimization layer includes a first parameterized single-qubit logic gate.

[0010] Optionally, the first parametric single-qubit logic gate includes a first RX rotation gate, a first RZ rotation gate, and a second RX rotation gate cascaded in sequence.

[0011] Optionally, the classification node further includes an alternating layer for evolving the quantum states of the first qubit and the second qubit based on the time evolution operator where \(i\) is the imaginary unit, \(H\) int is a Hamiltonian including the tensor product of multiple Pauli gates, and \(t\) is the time.

[0012] Optionally, the alternating layer includes a verification module, a phase shift module, and a restoration module, where:

[0013] The verification module includes multiple first CNOT gates, the control qubit of the first CNOT gate is the first qubit or the second qubit, and the target qubit of the first CNOT gate is an auxiliary qubit;

[0014] The phase shift module includes a second RZ rotation gate, a first Pauli X gate, a third RZ rotation gate, and a second Pauli X gate cascaded in sequence and acting on the auxiliary qubit, and the parameters of the second RZ rotation gate and the third RZ rotation gate are the time and the negative of the time, respectively;

[0015] The restoration module includes multiple second CNOT gates, the control qubit of the second CNOT gate is the first qubit or the second qubit, and the target qubit of the second CNOT gate is the auxiliary qubit.

[0016] Optionally, the preparation of the quantum state of the second qubit to the second target state representing the data to be classified includes:

[0017] Obtaining a second parametric single-qubit logic gate with the data to be classified as a parameter;

[0018] Preparing the quantum state of the second qubit to a preparatory quantum state;

[0019] Applying the second parametric single-qubit logic gate to the second qubit, such that the preparatory quantum state evolves to the second target state representing the data to be classified.

[0020] Optionally, the second parametric single-qubit logic gate includes a RY rotation gate.

[0021] Optionally, the data to be classified is multi-modal data, and the preparation of the quantum state of the second qubit to the second target state representing the data to be classified includes:

[0022] Converting the data to be classified in different modalities into the same data vector;

[0023] For each element of the same data vector, prepare the quantum state of the second qubit corresponding to the element to a second target state characterizing the element.

[0024] Optionally, measuring the second qubit to obtain the output result of the quantum neural network and converting the output result into a classification result includes:

[0025] Measure the second qubit to obtain the output results of one or more of the classification nodes, and input the output results into a transformation function to obtain a classification result.

[0026] Optionally, the transformation function is a linear function of the output result.

[0027] Optionally, the method further includes:

[0028] Training the quantum neural network to be optimized based on the simultaneous perturbation stochastic approximation algorithm to obtain an optimized value of the parameter of the first parameterized single-qubit logic gate included in the quantum neural network to be optimized;

[0029] Apply the optimized value to the quantum neural network to be optimized to obtain a trained quantum neural network for classifying the data to be classified.

[0030] Optionally, training the quantum neural network to be optimized based on the simultaneous perturbation stochastic approximation algorithm to obtain an optimized value of the parameter of the first parameterized single-qubit logic gate included in the quantum neural network to be optimized includes:

[0031] Obtain training data and construct a loss function of the quantum neural network to be optimized;

[0032] Subtract a first bias from the initial value of the parameter of the first parameterized single-qubit logic gate of the quantum neural network to be optimized, and input the training data into the quantum neural network to obtain a first result;

[0033] Add a second bias to the initial value of the parameter of the first parameterized single-qubit logic gate of the quantum neural network to be optimized, and input the training data into the quantum neural network to obtain a second result;

[0034] Calculate the descent gradient of the parameter of the quantum neural network to be optimized based on the first result and the second result;

[0035] Update the parameter based on the gradient descent algorithm and the descent gradient;

[0036] When it is determined that the value of the loss function of the quantum neural network after updating the parameter is less than a threshold, use the updated value of the parameter as the optimized value of the parameter.

[0037] In the second aspect of the embodiments of the present invention, a data classification device is provided, and the device includes:

[0038] An acquisition preparation module, configured to acquire data to be classified, prepare the quantum state of the first qubit to a first target state, and prepare the quantum state of the second qubit to a second target state representing the data to be classified;

[0039] An input module, configured to input the first target state and the second target state into a quantum neural network, where the quantum neural network includes a plurality of cascaded classification nodes, the input of the initial classification node among the plurality of cascaded classification nodes is the first target state and the second target state, and the input of the classification nodes other than the initial classification node among the plurality of cascaded classification nodes is the second target state and the quantum state of the first qubit output by the previous classification node;

[0040] A measurement conversion module, configured to measure the second qubit to obtain an output result of the quantum neural network, and convert the output result into a classification result.

[0041] Optionally, the classification node includes an optimization layer, and the optimization layer includes a first parametric single-qubit logic gate.

[0042] Optionally, the first parametric single-qubit logic gate includes a first RX rotation gate, a first RZ rotation gate, and a second RX rotation gate cascaded in sequence.

[0043] Optionally, the classification node further includes an alternating layer, and the alternating layer is configured to evolve the quantum states of the first qubit and the second qubit based on a time evolution operator where i is an imaginary number, H int is a Hamiltonian including a tensor product of a plurality of Pauli gates, and t is time.

[0044] Optionally, the alternating layer includes a verification module, a phase shift module, and a reduction module, where:

[0045] The verification module includes a plurality of first CNOT gates, the control qubit of the first CNOT gate is the first qubit or the second qubit, and the target qubit of the first CNOT gate is an auxiliary qubit;

[0046] The phase shift module includes a second RZ rotation gate, a first Pauli X gate, a third RZ rotation gate, and a second Pauli X gate cascaded in sequence and configured to act on the auxiliary qubit, and the parameters of the second RZ rotation gate and the third RZ rotation gate are the time and the negative of the time, respectively;

[0047] The reduction module includes a plurality of second CNOT gates. The control qubit of the second CNOT gate is the first qubit or the second qubit, and the target qubit of the second CNOT gate is the auxiliary qubit.

[0048] Optionally, the acquisition and preparation module is further configured to:

[0049] Acquire a second parameterized single-qubit logic gate with the data to be classified as a parameter;

[0050] Prepare the quantum state of the second qubit to a preparatory quantum state;

[0051] Apply the second parameterized single-qubit logic gate to the second qubit, so that the preparatory quantum state evolves to a second target state representing the data to be classified.

[0052] Optionally, the second parameterized single-qubit logic gate includes an RY rotation gate.

[0053] Optionally, the data to be classified is multimodal data, and the acquisition and preparation module is further configured to:

[0054] Convert the data to be classified in different modalities into the same data vector;

[0055] For each element of the same data vector, prepare the quantum state of the second qubit corresponding to the element to a second target state representing the element.

[0056] Optionally, the measurement and conversion module is further configured to:

[0057] Measure the second qubit to obtain output results of one or more of the classification nodes, and input the output results into a transformation function to obtain a classification result.

[0058] Optionally, the transformation function is a linear function of the output results.

[0059] Optionally, the apparatus further includes:

[0060] A training module, configured to train a quantum neural network to be optimized based on a simultaneous perturbation stochastic approximation algorithm, and obtain an optimized value of a parameter of a first parameterized single-qubit logic gate included in the quantum neural network to be optimized;

[0061] An application module, configured to apply the optimized value to the quantum neural network to be optimized to obtain a trained quantum neural network for classifying the data to be classified.

[0062] Optionally, the training module is further configured to:

[0063] Acquire training data and construct a loss function of the quantum neural network to be optimized;

[0064] Subtract the initial value of the parameter of the first parameterized single-qubit logic gate of the quantum neural network to be optimized by a first bias amount, and input the training data into the quantum neural network to obtain a first result;

[0065] Add the initial value of the parameter of the first parameterized single-qubit logic gate of the quantum neural network to be optimized by a second bias amount, and input the training data into the quantum neural network to obtain a second result;

[0066] Calculate the descent gradient of the parameter of the quantum neural network to be optimized based on the first result and the second result;

[0067] Update the parameter based on the gradient descent algorithm and the descent gradient;

[0068] When it is determined that the value of the loss function of the quantum neural network after updating the parameter is less than the threshold, use the updated value of the parameter as the optimized value of the parameter.

[0069] In a third aspect of the embodiments of the present invention, a storage medium is provided, in which a computer program is stored, and the computer program is configured to execute the steps of the method described in any one of the first aspects when running.

[0070] In a fourth aspect of the embodiments of the present invention, an electronic device is provided, including a memory and a processor, a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps of the method described in any one of the first aspects.

[0071] Based on the above technical solution, in the process of processing the data to be classified, a second qubit is prepared to participate in the quantum computing process for preparing the second target state representing the data to be classified to calculate the classification result, and a first qubit is prepared to memorize the characteristic data of the second target state and is transmitted between different classification nodes, so that each classification node can perform quantum computing according to the quantum state of the first qubit output by the previous classification node received and the current input second target state, and store the calculation result, that is, the classification result, in the quantum state output of the second qubit. Since the first qubit is not measured throughout the process, the characteristic data stored in it can be continuously transmitted and utilized by each classification node. Therefore, for classification nodes that are far apart, the data to be classified input thereto can also be effectively utilized by subsequent classification nodes, improving the accuracy of classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 It is a hardware structure block diagram of a computer terminal of a data classification method shown according to an exemplary embodiment.

[0073] Figure 2 It is a flowchart of a data classification method shown according to an exemplary embodiment.

[0074] Figure 3 It is a model diagram of a quantum neural network shown according to an exemplary embodiment.

[0075] Figure 4 It is a model diagram of a classification node of a quantum neural network shown according to an exemplary embodiment.

[0076] Figure 5 It is a model diagram of an alternating layer of a classification node of a quantum neural network shown according to an exemplary embodiment.

[0077] Figure 6 It is a model diagram of a classification node of a quantum neural network shown according to an exemplary embodiment.

[0078] Figure 7 It is a flowchart of step S21 included in a data classification method shown according to an exemplary embodiment.

[0079] Figure 8 It is another flowchart of step S21 included in a data classification method shown according to an exemplary embodiment.

[0080] Figure 9 It is another flowchart of a data classification method shown according to an exemplary embodiment.

[0081] Figure 10 It is a flowchart of step S91 included in a data classification method shown according to an exemplary embodiment.

[0082] Figure 11 It is a block diagram of a data classification device shown according to an exemplary embodiment. Detailed implementation manners

[0083] The embodiments described below by referring to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0084] The embodiments of the present invention first provide a data classification method, which can be applied to an electronic device, such as a computer terminal, specifically, such as an ordinary computer, a quantum computer, etc.

[0085] The following takes running on a computer terminal as an example to describe it in detail. Figure 1 It is a hardware structure block diagram of a computer terminal of a data classification method shown according to an exemplary embodiment. As Figure 1 shown, the computer terminal may include one or more ( Figure 1Only one processor 102 is shown (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a field-programmable gate array FPGA), and a memory 104 for storing a data classification method based on quantum circuits. Optionally, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 The structure shown is only schematic and does not limit the structure of the computer terminal. For example, the computer terminal may further include more or fewer components than those shown Figure 1 in the figure, or have a different configuration from that Figure 1 shown.

[0086] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / modules corresponding to the data classification method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor 102, and these remote memories may be connected to the computer terminal through a network. Examples of the above network include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0087] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of the computer terminal. In one instance, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0088] It should be noted that a real quantum computer has a hybrid structure, which includes two major parts: one is a classical computer, responsible for performing classical calculations and controls; the other is a quantum device, responsible for running quantum programs to implement quantum calculations. And a quantum program is a series of instruction sequences written in a quantum language such as the QRunes language that can run on a quantum computer, which supports operations on quantum logic gates and ultimately realizes quantum calculations. Specifically, a quantum program is a series of instruction sequences that operate quantum logic gates in a certain time sequence.

[0089] In practical applications, due to the limitations of the development of quantum device hardware, quantum computing simulation is usually required to verify quantum algorithms, quantum applications, etc. Quantum computing simulation is a process of simulating the operation of a quantum program corresponding to a specific problem by means of a virtual architecture (i.e., a quantum virtual machine) built with the resources of a general-purpose computer. Generally, a quantum program corresponding to a specific problem needs to be constructed. The quantum program referred to in the embodiments of the present invention is a program written in a classical language that represents quantum bits and their evolution, and quantum bits, quantum logic gates, etc. related to quantum computing are all represented by corresponding classical codes.

[0090] As a manifestation of a quantum program, a quantum circuit, also known as a quantum logic circuit, is the most commonly used general quantum computing model, which represents a circuit for operating on quantum bits under an abstract concept. Its composition includes quantum bits, a circuit (timeline), and various quantum logic gates. Finally, the result often needs to be read out through a quantum measurement operation.

[0091] Different from traditional circuits that are connected by metal wires to transmit voltage signals or current signals, in a quantum circuit, the circuit can be regarded as being connected by time, that is, the state of quantum bits evolves naturally over time. During this process, according to the instructions of the Hamiltonian operator, it is not until it encounters a logic gate that it is operated on.

[0092] A quantum program as a whole corresponds to a total quantum circuit. The quantum program referred to in the present invention refers to this total quantum circuit. Among them, the total number of quantum bits in this total quantum circuit is the same as the total number of quantum bits of the quantum program. It can be understood that a quantum program can be composed of a quantum circuit, a measurement operation for the quantum bits in the quantum circuit, a register for storing the measurement results, and a control flow node (jump instruction). A quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution process of a quantum program is a process of executing all quantum logic gates in a certain time sequence. It should be noted that the time sequence is the time order in which a single quantum logic gate is executed.

[0093] It should be noted that in classical computing, the most basic unit is the bit, and the most basic control mode is the logic gate. The purpose of controlling a circuit can be achieved through the combination of logic gates. Similarly, the way to process qubits is the quantum logic gate. Using quantum logic gates can evolve quantum states. Quantum logic gates are the basis for constructing quantum circuits. Quantum logic gates include single-qubit quantum logic gates such as the Hadamard gate (H gate, Hadamard gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), RX gate, RY gate, RZ gate, etc.; multi-qubit quantum logic gates such as the CNOT gate, CR gate, iSWAP gate, Toffoli gate, etc. Quantum logic gates are generally represented by unitary matrices, and unitary matrices are not only in matrix form but also a kind of operation and transformation. Generally, the action of a quantum logic gate on a quantum state is calculated by left-multiplying the unitary matrix by the matrix corresponding to the right vector of the quantum state.

[0094] Figure 2 is a schematic flowchart of a data classification method shown according to an exemplary embodiment, as Figure 2 shown, the method includes:

[0095] S21, obtain the data to be classified, prepare the quantum state of the first qubit to the first target state, and prepare the quantum state of the second qubit to the second target state representing the data to be classified.

[0096] S22, input the first target state and the second target state into a quantum neural network, the quantum neural network includes a plurality of cascaded classification nodes, the input of the initial classification node among the plurality of cascaded classification nodes is the first target state and the second target state, and the input of the classification nodes other than the initial classification node among the plurality of cascaded classification nodes is the second target state and the quantum state of the first qubit output by the previous classification node.

[0097] S23, measure the second qubit to obtain the output result of the quantum neural network, and convert the output result into a classification result.

[0098] In step S21, the data to be classified is the object to be classified. For example, it can be multiple pictures containing animals, and the pictures need to be classified into types such as cats, dogs, cows, etc. It can be single-modal data or multi-modal data. For example, the data to be classified can be at least one of speech, text, and video. In a possible implementation manner, the data to be classified can be multi-modal data for emotion classification, which includes speech, text, and video, and then classify the corresponding emotion according to this information to obtain the emotion type corresponding to the data to be classified, such as happy, sad, etc. For example, when a person falls, a set of speech, text, and video corresponding to this scene can be used as a set of data to be classified and classified to obtain emotions such as sad and angry.

[0099] The data to be classified can be obtained by means such as voice input, keyboard input, touch screen input, etc. and sent to the classical computer part of the above-mentioned quantum computer. After obtaining the data to be classified, the classical computer sends instructions to the quantum device of the above-mentioned quantum computer, so that the quantum state of the first qubit in the quantum device is prepared to the first target state, and the quantum state of the second qubit in the quantum device is prepared to the second target state. For example, the quantum state of the first qubit can be prepared to i.e., n A the quantum state of each of the first qubits is |0>, and the quantum state of the second qubit can be prepared to |x>, where x is the data to be classified. It should be noted that the first qubit and the second qubit are different qubits in the quantum device. The first qubit can be one or more, and the second qubit can also be one or more. Their quantities are determined according to specific situations, and the present invention does not make specific limitations on them.

[0100] In step S22, the quantum neural network (QNN) is a neural network implemented based on a quantum computer, and part or all of it can be implemented on the quantum device of the quantum computer. The quantum neural network consists of multiple cascaded classification nodes, that is, the input and output connections of the same quantum circuit correspond to the previous classification node and the next classification node. When the first target state and the second target state are input into the quantum neural network, the first target state and the second target state are input into the initial classification node among the multiple classification nodes, that is, the first classification node that acts on the first qubit and the second qubit. Since the classification nodes are cascaded with each other, for the second classification node, the quantum state of the first qubit output by the initial classification node and the second target state are input into this second classification node. For subsequent classification nodes, the input and output process corresponding to the second classification node is repeated. Among them, for each classification node, the output result can be obtained by measuring the second qubit corresponding to the action of this classification node. It should be noted that the data to be classified corresponding to the second target state input into each classification node can be different data. After the second target state of the second qubit is input into the previous classification node, the quantum state of the second qubit can be prepared to another second target state different from this second target state to be input into the next classification node.

[0101] See Figure 3, taking a quantum neural network with 3 classification nodes as an example, the first target state of the first qubit 31 and the second target state of the second qubit 32 are first input into the classification node 331. Then, the quantum state of the first qubit 31 output by this classification node 331 and the next second target state are input into the classification node 332. Next, the quantum state of the first qubit 31 output by the classification node 332 and another second target state of the second qubit 32 are input into the classification node 333, completing the process of inputting the first target state and the second target state into the quantum neural network. Figure 3 The second qubits 32 corresponding to different classification nodes are the same qubits, and their different positions indicate different times when they are acted on by different classification nodes. It should be noted that the second qubit 32 will be prepared to the second target state before being input into the classification node. For the sake of simplicity of the illustration, Figure 3 the corresponding quantum logic gates are omitted in the figure.

[0102] For each classification node, the first qubit corresponding to its action is used to memorize the characteristic data of the second target state of the second qubit corresponding to its action. Then, when the subsequent classification node acts on the first qubit, the characteristic data of the second target state of the input previous classification node that it has memorized can be obtained from the first qubit, and calculations are performed based on it and the second target state input to the current classification node to obtain the classification result.

[0103] Optionally, as Figure 4 shown, the classification node includes an optimization layer 41, and the optimization layer 41 includes a first parameterized single-qubit logic gate. The first parameterized single-qubit logic gate is a quantum logic gate containing parameters. When the parameter value changes, the effect of the first parameterized single-qubit logic gate acting on the qubit changes accordingly. For example, the first parameterized single-qubit logic gate can be at least one of the RX rotation gate, i.e., the above-mentioned RX gate, the RY rotation gate, i.e., the above-mentioned RY gate, and the RZ rotation gate, i.e., the above-mentioned RZ gate. By introducing the first parameterized single-qubit logic gate, the quantum neural network can obtain the optimal parameter value through machine learning training.

[0104] In a possible implementation, the first parametric single-qubit logic gate includes a first RX rotation gate, a first RZ rotation gate, and a second RX rotation gate cascaded in sequence. That is, when the first target state and the second target state are input to the optimization layer, the first RX rotation gate first acts on the first qubit or the second qubit, then the first RZ rotation gate acts on the qubit after the action of the first RX rotation gate, and finally the second RX rotation gate acts on this qubit. Specifically, for each first qubit and each second qubit, the first RX rotation gate, the first RZ rotation gate, and the second RX rotation gate can be set in the quantum circuit where they are located. Of course, in other implementations, the first parametric single-qubit logic gate can also include other parametric quantum logic gates, such as the RY rotation gate.

[0105] Optionally, as Figure 4 shown, the classification node further includes an alternating layer 42, and the alternating layer 42 is used to evolve the quantum states of the first qubit and the second qubit based on the time evolution operator where i is the imaginary unit, H int is a Hamiltonian including the tensor product of multiple Pauli gates, and t is the time.

[0106] As Figure 4 shown, the alternating layer 42 is connected to the above-mentioned optimization layer 41. The time evolution operator is obtained according to the Schrödinger formula, which describes the evolution process of a qubit. Therefore, each quantum logic gate acting on a qubit can be described by the corresponding time evolution operator. As described above, the time evolution operator of the alternating layer is When the Pauli gates in the Hamiltonian H int have a tensor product form, it can entangle multiple qubits, and then a quantum neural network can be trained to complete the quantum computing process for classification calculation after the quantum state output by the optimization layer is input to the alternating layer.

[0107] Optionally, referring to Figure 5 and Figure 6 , the alternating layer 42 includes a verification module 421, a phase shift module 422, and a restoration module 423, where:

[0108] The verification module 421 includes multiple first CNOT gates. The control qubit of the first CNOT gate is the first qubit or the second qubit, and the target qubit of the first CNOT gate is the auxiliary qubit 43;

[0109] The phase shift module 422 includes a second RZ rotation gate 4221, a first Pauli X gate 4222, a third RZ rotation gate 4223, and a second Pauli X gate 4224 that are cascaded in sequence and are used to act on the auxiliary qubit 43. The parameters of the second RZ rotation gate 4221 and the third RZ rotation gate 4223 are the time and the negative of the time, respectively.

[0110] The reduction module 423 includes a plurality of second CNOT gates. The control qubit of the second CNOT gate is the first qubit or the second qubit, and the target qubit of the second CNOT gate is the auxiliary qubit 43.

[0111] See Figure 5 , in a possible implementation, for the verification module 421, the number of first CNOT gates is the same as the total number of the first qubit and the second qubit. For each first qubit and each second qubit, a first CNOT gate is set between the first qubit or the second qubit and the auxiliary qubit 43, so as to complete the parity check of the quantum states of the first qubit and the second qubit, and store the parity check result in the auxiliary qubit 43. It should be noted that the parity check result here refers to the parity of the number of qubits with a value of 1 in the computational basis of the qubits of the system involved in the Hamiltonian H int For example, for the computational basis |010>, only the second qubit has a value of 1, so its parity check result is odd. For the computational basis |011>, the second and third qubits have values of 1, so its parity check result is even.

[0112] For the phase shift module 422, see Figure 5 and Figure 6 , if the parity check result is even, the phase shift applied to the first qubit and the second qubit is e -it , if the parity check result is odd, the phase shift applied to the first qubit and the second qubit is e it . Then, the second RZ rotation gate 4221, the first Pauli X gate 4222, the third RZ rotation gate 4223, and the second Pauli X gate 4224 in the phase shift module 422 are sequentially applied to the auxiliary qubit 43 to complete the above phase shift operation.

[0113] For the restoration module 423, the number of the second CNOT gates is the same as the total number of the first qubits and the second qubits. For each of the first qubits and each of the second qubits, a second CNOT gate is provided between the first qubit or the second qubit and the auxiliary qubit 43, and for the first CNOT gate and the second CNOT gate with the same acting object, their orders in the verification module 421 and the restoration module 423 are opposite. Refer to Figure 5 , for the first CNOT gate and the second CNOT gate acting on the qubits of the uppermost quantum circuit in the figure and the auxiliary qubit 43, the first CNOT gate acts on the acting object first in the verification module 421, while the second CNOT gate acts on the acting object last in the restoration module 423, thereby realizing the inverse operation of the verification module 421 and completing the restoration of the auxiliary qubit 43.

[0114] Through the verification module 421, the phase shift module 422, and the restoration module 423, the simulation of the Hamiltonian , that is, the tensor product of n Pauli Z gates can be realized. Of course, in other embodiments, the Hamiltonian H int can also be in other forms and be realized by corresponding quantum circuits. For example:

[0115]

[0116] where a j , J jk are parameters, n is the sum of the number of the first qubits and the second qubits, X is the Pauli X gate, Z is the Pauli Z gate, and Z j Z k represents the tensor product of two Pauli Z gates.

[0117] For example, assume that there is only 1 second qubit. The data x to be classified is encoded into the second target state through the RY rotation gate U in (x) = R y (arccos(x)), and the quantum states of the first qubits are all prepared to the |0> state. Then the density matrix of the system corresponding to the first qubits and the second qubit is:

[0118]

[0119] where I is the Pauli identity matrix, X is the Pauli X matrix, Z is the Pauli Z matrix, and n A is the number of the first qubits. After the action of the classification node, the density matrix of the system is:

[0120]

[0121] where That is, the tensor product form of the corresponding Pauli operator, where n is the total number of the first qubit and the second qubit, and C 1P (θ), C 2P (θ), C 3P (θ) are real coefficients, which means that the expectation value of any Pauli operator P can be written as a linear combination, and the output result can also be composed of them. Furthermore, the reduced density matrix corresponding to the first qubit of the next classification node input is:

[0122]

[0123] where C′ 1P (θ), C′ 2P (θ), C′ 3P (θ) are real coefficients. Then, the second target state corresponding to another data to be classified x′ is input into the next classification node. After the classification node acts on the entire system, the density matrix of the entire system is:

[0124]

[0125] where C″ ip (θ) is a real coefficient. It can be seen that non-linear functions such as xx′ are generated by the tensor product structure of the quantum system. At the same time, the quantum neural network can select the terms stored in the first qubit by training its own parameters, so that the first qubit completes the memory of the second target state. For example, if the classification node converts into a local Pauli operator that only acts on the first qubit, the quantum neural network can completely retain the x term in . If the classification node converts into a Pauli operator that acts on the first qubit and the second qubit, x will disappear in . If the classification node acts in an intermediate way between the above two extreme cases, then the size of x in is smaller than that in the previous case, that is, the quantum neural network partially "forgets" x.

[0126] In step S23, the second qubit is measured to obtain the output result. For example, the output result can be multiple possible quantum states and the occurrence probabilities of these quantum states. Furthermore, the corresponding transformation function can be used to change the output result into the desired classification result, such as the occurrence probabilities of different emotions. The measurement can be realized by the measurement logic gate in the quantum device, and the transformation of the output result can be realized by the classical computer part of the quantum computer.

[0127] Optionally, in step S23, measuring the second qubit to obtain the output result of the quantum neural network and converting the output result into a classification result includes:

[0128] Measuring the second qubit to obtain the output results of one or more of the classification nodes, and inputting the output results into a transformation function to obtain a classification result.

[0129] For example, after each classification node acts on the first qubit and the second qubit, the second qubit after the action of the classification node can be measured to obtain multiple output results, and all these classification results are input into the transformation function for data conversion. Of course, it is also possible to only measure one output result, for example, measuring the second qubit corresponding to the last classification node to obtain the output result, or measuring the output results corresponding to some of the classification nodes. For Figure 3 example, it is possible to measure the second qubit corresponding to each classification node to obtain all the output results y0, y1, y2, or only measure the output result y2. Optionally, the transformation function is a linear function of the output results, for example, a linear combination of the probabilities of the quantum states that each output result may appear in, and the parameters of this linear function can be optimized through the training of the quantum neural network. Of course, in other possible implementation manners, the transformation function can also be other functions, such as polynomial functions, exponential functions, etc., and the corresponding parameter values are obtained through training. In this regard, the present invention does not make specific limitations.

[0130] Based on the above technical solution, in the process of processing the data to be classified, a second qubit is prepared to participate in the quantum computing process for preparing the second target state representing the data to be classified to calculate the classification result, and a first qubit is prepared to memorize the characteristic data of the second target state and is transmitted between different classification nodes, so that each classification node can perform quantum computing according to the quantum state of the first qubit output by the previous classification node received and the current input second target state, and store the calculation result, that is, the classification result, in the quantum state output of the second qubit. Since the first qubit is not measured throughout the process, the characteristic data stored in it can be continuously transmitted and utilized by each classification node. Therefore, for classification nodes that are far apart, the data to be classified input into them can also be effectively utilized by subsequent classification nodes, improving the accuracy of classification.

[0131] Optionally, referring to Figure 7 , preparing the quantum state of the second qubit to the second target state representing the data to be classified includes:

[0132] S211, obtaining a second single-qubit logical gate with parameters taking the data to be classified as a parameter.

[0133] S213. Prepare the quantum state of the second qubit to the preparatory quantum state.

[0134] S215. Apply the second parameterized single-qubit logic gate to the second qubit, causing the preparatory quantum state to evolve to the second target state representing the data to be classified.

[0135] In step S211, the second parameterized single-qubit logic gate is a single-qubit logic gate that includes parameters. For example, it can be at least one of the RX rotation gate, the RY rotation gate, and the RZ rotation gate. In one possible implementation, the second parameterized single-qubit logic gate includes the RY rotation gate. Specifically, after the classical computer part of the quantum computer obtains the data to be classified, it is used as a parameter to enable the quantum device to construct the second parameterized single-qubit logic gate. For example, for the data to be classified x, the second parameterized single-qubit logic gate R y (arccos(x)) can be constructed.

[0136] Furthermore, in step S213, for the obtained second qubit, its quantum state can be prepared to the preparatory quantum state through the quantum device. The preparatory quantum state can be That is, the quantum state of each second qubit is prepared to |0>, where n B is the number of second qubits.

[0137] After obtaining the above-mentioned second parameterized single-qubit logic gate and preparing the second qubit to the above-mentioned preparatory quantum state, step S215 is executed. The second parameterized single-qubit logic gate is applied to the second qubit through the quantum device, causing the preparatory quantum state to evolve to the second target state. It should be noted that there is no specific limitation on the execution order of step S211 and step S213, and they can be executed simultaneously.

[0138] Optionally, the data to be classified can be multimodal data. Refer to Figure 8 , preparing the quantum state of the second qubit to the second target state representing the data to be classified includes:

[0139] S212. Convert the data to be classified in different modalities into the same data vector.

[0140] S214. For each element of the same data vector, prepare the quantum state of the second qubit corresponding to the element to the second target state representing the element.

[0141] In step S212, for the data to be classified in different modalities, it is transformed into the same data vector. For example, for the multi-modal data of video, voice, and text obtained in the above-mentioned scenario of a person falling, it can be transformed into a 3D data vector [x1, x2, x3] through methods such as word embedding. Furthermore, in step S214, for each element in the 3D vector, three second qubits are prepared to represent each of its elements. The specific representation method can refer to the above steps S211 to S215, or other methods can also be adopted. The present invention does not make specific limitations on it. By simultaneously inputting the data to be classified in different modalities into a classification node for calculation, it can be fused in the classification node to improve the utilization efficiency of the data.

[0142] Figure 9 is another flowchart of a data classification method shown according to an exemplary embodiment, as Figure 9 shown, the method includes:

[0143] S91, training the quantum neural network to be optimized based on the simultaneous perturbation stochastic approximation algorithm to obtain the optimized values of the parameters of the first parameterized single-qubit logic gates included in the quantum neural network to be optimized.

[0144] S92, applying the optimized values to the quantum neural network to be optimized to obtain the trained quantum neural network for classifying the data to be classified.

[0145] S93, obtaining the data to be classified, preparing the quantum state of the first qubit to the first target state, and preparing the quantum state of the second qubit to the second target state representing the data to be classified.

[0146] S94, inputting the first target state and the second target state into the quantum neural network. The quantum neural network includes a plurality of cascaded classification nodes. The input of the initial classification node among the plurality of cascaded classification nodes is the first target state and the second target state. The input of the classification nodes other than the initial classification node among the plurality of cascaded classification nodes is the second target state and the quantum state of the first qubit output by the previous classification node.

[0147] S95, measuring the second qubit to obtain the output result of the quantum neural network, and converting the output result into a classification result.

[0148] In step S91, the quantum neural network to be optimized, i.e., an untrained quantum neural network or a trained quantum neural network whose classification effect fails to meet the expectation, is trained by the Simultaneous Perturbation Stochastic Approximation (SPSA) algorithm to obtain the optimized values of the parameters of the first parameterized single-qubit logic gates in the quantum neural network to be optimized. The optimized values refer to the parameter values that can enable the quantum neural network to achieve the expected classification effect.

[0149] After obtaining the optimized values, step S92 is executed. These optimized values are applied to the above-mentioned quantum neural network to be optimized, that is, each pair of optimized values is applied to the parameters of the first parameterized single-qubit logic gates, and then the trained quantum neural network that meets the expected classification effect can be obtained for classifying the data to be classified.

[0150] After obtaining the trained quantum neural network, steps S93 to S95 are executed. The specific execution manner can refer to the above steps S21 to S23, and this application does not make specific restrictions on this.

[0151] Optionally, referring to Figure 10 , training the quantum neural network to be optimized based on the Simultaneous Perturbation Stochastic Approximation algorithm to obtain the optimized values of the parameters of the first parameterized single-qubit logic gates included in the quantum neural network to be optimized, including:

[0152] S911, obtaining training data and constructing the loss function of the quantum neural network to be optimized.

[0153] S912, subtracting the first bias from the initial values of the parameters of the first parameterized single-qubit logic gates of the quantum neural network to be optimized, and inputting the training data into this quantum neural network to obtain the first result.

[0154] S913, adding the second bias to the initial values of the parameters of the first parameterized single-qubit logic gates of the quantum neural network to be optimized, and inputting the training data into this quantum neural network to obtain the second result.

[0155] S914, calculating the descent gradient of the parameters of the quantum neural network to be optimized based on the first result and the second result.

[0156] S915, updating the parameters based on the gradient descent algorithm and the descent gradient.

[0157] S916, when it is determined that the value of the loss function of the quantum neural network after updating the parameters is less than the threshold, taking the updated value of the parameters as the optimized value of the parameters.

[0158] In step S911, the training data may include sample data and label data corresponding to the sample data. For example, the sample data is video, audio, and text data obtained from the above-mentioned scenario of a person falling, and the corresponding labels may be emotions such as anger and sadness added manually. The acquisition of the training data can be implemented through the classical computer part of the quantum computer, and the loss function of the quantum neural network is constructed through the classical computer to characterize the difference between the output result of the training data and the label data. For example, it can be the sum of their squares.

[0159] In steps S912 and S913, the initial values of the above parameters are respectively added with and subtracted by the second bias and the first bias to obtain different quantum neural network models. Then, the training data is input into these two different quantum neural network models to obtain the second result and the first result. Then, step S914 is executed. The classical computer can calculate the descent gradient of the parameters of the quantum neural network to be optimized according to the first result and the second result, which represents the fastest direction of parameter change. For example, the descent gradient can be:

[0160]

[0161] Wherein, x is the training data, I(x) represents encoding x into the second target state for inputting to the classification node, i represents the index of the classification node, and G i (θ i ) represents the classification node, and θ i is the parameter of the first parameterized single-qubit logic gate. is the observable, and I H (x), are the conjugate transposes of I(x) and G i (θ i ), respectively.

[0162] After calculating the descent gradient, step S915 is executed. The descent gradient is substituted into the gradient descent algorithm to calculate the new parameter values to update the foregoing parameters. Furthermore, in step S916, if after the parameters are updated, the value of the above loss function is less than the threshold, it indicates that the classification effect of the quantum neural network corresponding to the updated parameter value can meet the expectation. Then, the updated parameter value is used as the optimized value and substituted into the quantum neural network to be optimized to obtain the trained quantum neural network that can achieve the expected classification effect. Of course, if after the parameters are updated, the value of the loss function is greater than or equal to the threshold, steps S912 and subsequent steps can be executed again until the value of the loss function is less than the threshold.

[0163] Figure 11 is a block diagram of a data classification device shown according to an exemplary embodiment. As Figure 11 shown, the device 110 includes:

[0164] An acquisition and preparation module 111, configured to acquire data to be classified, prepare the quantum state of the first qubit to a first target state, and prepare the quantum state of the second qubit to a second target state representing the data to be classified;

[0165] An input module 112, configured to input the first target state and the second target state into a quantum neural network, the quantum neural network including a plurality of cascaded classification nodes, the input of the initial classification node among the plurality of cascaded classification nodes being the first target state and the second target state, and the input of the classification nodes other than the initial classification node among the plurality of cascaded classification nodes being the second target state and the quantum state of the first qubit output by the previous classification node;

[0166] A measurement and conversion module 113, configured to measure the second qubit to obtain an output result of the quantum neural network, and convert the output result into a classification result.

[0167] Optionally, the classification node includes an optimization layer, and the optimization layer includes a first parametric single-qubit logic gate.

[0168] Optionally, the first parametric single-qubit logic gate includes a first RX rotation gate, a first RZ rotation gate, and a second RX rotation gate cascaded in sequence.

[0169] Optionally, the classification node further includes an alternating layer, and the alternating layer is configured to evolve the quantum states of the first qubit and the second qubit based on a time evolution operator where i is an imaginary number, H int is a Hamiltonian including a tensor product of a plurality of Pauli gates, and t is time.

[0170] Optionally, the alternating layer includes a verification module, a phase shift module, and a restoration module, where:

[0171] The verification module includes a plurality of first CNOT gates, the control qubit of the first CNOT gate being the first qubit or the second qubit, and the target qubit of the first CNOT gate being an auxiliary qubit;

[0172] The phase shift module includes a second RZ rotation gate, a first Pauli X gate, a third RZ rotation gate, and a second Pauli X gate cascaded in sequence and configured to act on the auxiliary qubit, and the parameters of the second RZ rotation gate and the third RZ rotation gate are the time and the negative of the time, respectively;

[0173] The reduction module includes a plurality of second CNOT gates. The control bit of the second CNOT gate is the first qubit or the second qubit, and the target bit of the second CNOT gate is the auxiliary qubit.

[0174] Optionally, the acquisition and preparation module 111 is further configured to:

[0175] Acquire a second single-qubit parametric logic gate with the data to be classified as a parameter;

[0176] Prepare the quantum state of the second qubit to a preparatory quantum state;

[0177] Apply the second single-qubit parametric logic gate to the second qubit, so that the preparatory quantum state evolves to a second target state representing the data to be classified.

[0178] Optionally, the second single-qubit parametric logic gate includes a RY rotation gate.

[0179] Optionally, the data to be classified is multimodal data, and the acquisition and preparation module 111 is further configured to:

[0180] Convert the data to be classified in different modalities into the same data vector;

[0181] For each element of the same data vector, prepare the quantum state of the second qubit corresponding to the element to a second target state representing the element.

[0182] Optionally, the measurement and conversion module 113 is further configured to:

[0183] Measure the second qubit to obtain output results of one or more of the classification nodes, and input the output results into a transformation function to obtain a classification result.

[0184] Optionally, the transformation function is a linear function of the output results.

[0185] Optionally, the apparatus 110 further includes:

[0186] A training module, configured to train a quantum neural network to be optimized based on the simultaneous perturbation stochastic approximation algorithm, and obtain an optimized value of the parameter of the first single-qubit parametric logic gate included in the quantum neural network to be optimized;

[0187] An application module, configured to apply the optimized value to the quantum neural network to be optimized, and obtain a trained quantum neural network for classifying the data to be classified.

[0188] Optionally, the training module is further configured to:

[0189] Obtain training data and construct a loss function for the quantum neural network to be optimized;

[0190] Subtract the first bias from the initial value of the parameter of the first parametric single-qubit logic gate of the quantum neural network to be optimized, and input the training data into the quantum neural network to obtain a first result;

[0191] Add the second bias to the initial value of the parameter of the first parametric single-qubit logic gate of the quantum neural network to be optimized, and input the training data into the quantum neural network to obtain a second result;

[0192] Calculate the descent gradient of the parameter of the quantum neural network to be optimized based on the first result and the second result;

[0193] Update the parameter based on the gradient descent algorithm and the descent gradient;

[0194] When it is determined that the value of the loss function of the quantum neural network after updating the parameter is less than the threshold, use the updated value of the parameter as the optimized value of the parameter.

[0195] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment related to the method, and will not be elaborated here.

[0196] Another embodiment of the present invention further provides a storage medium, in which a computer program is stored, and wherein the computer program is configured to execute the steps in any one of the above method embodiments when running.

[0197] Specifically, in this embodiment, the above storage medium may include, but is not limited to: USB flash drive, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disk, magnetic disk or optical disc, etc., various media that can store computer programs.

[0198] Another embodiment of the present invention further provides an electronic device, including a memory and a processor, a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0199] Specifically, the above electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0200] Specifically, in this embodiment, the above processor may be configured to execute the following steps through a computer program:

[0201] Obtain data to be classified, prepare the quantum state of the first qubit to a first target state, and prepare the quantum state of the second qubit to a second target state representing the data to be classified; input the first target state and the second target state into a quantum neural network, the quantum neural network includes a plurality of cascaded classification nodes, the input of the initial classification node among the plurality of cascaded classification nodes is the first target state and the second target state, and the input of the classification nodes other than the initial classification node among the plurality of cascaded classification nodes is the second target state and the quantum state of the first qubit output by the previous classification node; measure the second qubit to obtain the output result of the quantum neural network, and convert the output result into a classification result.

[0202] The structure, features and effects of the present invention have been described in detail based on the embodiments shown in the drawings. The above is only the preferred embodiment of the present invention, but the present invention is not limited to the scope defined by the drawings. Any changes made according to the concept of the present invention, or equivalent embodiments modified to equivalent changes, still within the spirit covered by the specification and drawings, shall be within the protection scope of the present invention.

Claims

1. A data classification method, characterized in that, The method includes: Obtaining data to be classified, preparing the quantum state of the first qubit to a first target state, and preparing the quantum state of the second qubit to a second target state representing the data to be classified; Input the first target state and the second target state into a quantum neural network, where the quantum neural network includes a plurality of cascaded classification nodes. The input of the initial classification node among the plurality of cascaded classification nodes is the first target state and the second target state, and the input of the classification nodes other than the initial classification node among the plurality of cascaded classification nodes is the second target state and the quantum state of the first qubit output by the previous classification node; wherein, the classification node includes an alternating layer, and the alternating layer is used to evolve the quantum states of the first qubit and the second qubit based on a time evolution operator evolve, where i is the imaginary unit, is a Hamiltonian including the tensor product of a plurality of Pauli gates, t is time, and the alternating layer includes a verification module, a phase shift module, and a restoration module, where: the verification module includes a plurality of first CNOT gates, the control qubit of the first CNOT gate is the first qubit or the second qubit, and the target qubit of the first CNOT gate is an auxiliary qubit; the phase shift module includes a second RZ rotation gate, a first Pauli X gate, a third RZ rotation gate, and a second Pauli X gate that are cascaded in sequence and act on the auxiliary qubit, and the parameters of the second RZ rotation gate and the third RZ rotation gate are the time and the negative of the time, respectively; the restoration module includes a plurality of second CNOT gates, the control qubit of the second CNOT gate is the first qubit or the second qubit, and the target qubit of the second CNOT gate is the auxiliary qubit; Measuring the second qubit to obtain the output result of the quantum neural network, and converting the output result into a classification result.

2. The method according to claim 1, characterized in that, The classification node further includes an optimization layer, and the optimization layer includes a first parameterized single-qubit logic gate.

3. The method according to claim 2, wherein The first parameterized single-qubit logic gate includes a first RX rotation gate, a first RZ rotation gate, and a second RX rotation gate cascaded in sequence.

4. The method according to claim 1, characterized in that, The preparing the quantum state of the second qubit to a second target state representing the data to be classified includes: Obtaining a second parameterized single-qubit logic gate with the data to be classified as a parameter; Preparing the quantum state of the second qubit to a preparatory quantum state; Applying the second parameterized single-qubit logic gate to the second qubit, so that the preparatory quantum state evolves to a second target state representing the data to be classified.

5. The method according to claim 4, characterized in that, The second parameterized single-qubit logic gate includes a RY rotation gate.

6. The method according to claim 1, wherein The data to be classified is multimodal data, and the preparing the quantum state of the second qubit to a second target state representing the data to be classified includes: Converting the data to be classified in different modalities into the same data vector; For each element of the same data vector, preparing the quantum state of the second qubit corresponding to the element to a second target state representing the element.

7. The method according to claim 1, wherein The measuring the second qubit to obtain the output result of the quantum neural network, and converting the output result into a classification result includes: Measuring the second qubit to obtain the output results of one or more of the classification nodes, and inputting the output results into a transformation function to obtain a classification result.

8. The method according to claim 7, characterized in that, The transformation function is a linear function of the output result.

9. The method according to claim 2, wherein The method further includes: Training the quantum neural network to be optimized based on the simultaneous perturbation stochastic approximation algorithm to obtain an optimized value of the parameter of the first parameterized single-qubit logic gate included in the quantum neural network to be optimized; Applying the optimized value to the quantum neural network to be optimized to obtain a trained quantum neural network for classifying the data to be classified.

10. The method according to claim 9, characterized in that The training the quantum neural network to be optimized based on the simultaneous perturbation stochastic approximation algorithm to obtain an optimized value of the parameter of the first parameterized single-qubit logic gate included in the quantum neural network to be optimized includes: Obtaining training data and constructing a loss function of the quantum neural network to be optimized; Subtracting a first bias from the initial value of the parameter of the first parameterized single-qubit logic gate of the quantum neural network to be optimized, and inputting the training data into the quantum neural network to obtain a first result; Adding a second bias to the initial value of the parameter of the first parameterized single-qubit logic gate of the quantum neural network to be optimized, and inputting the training data into the quantum neural network to obtain a second result; Calculating a descending gradient of the parameter of the quantum neural network to be optimized based on the first result and the second result; Updating the parameter based on the gradient descent algorithm and the descending gradient; When it is determined that the value of the loss function of the quantum neural network after updating the parameter is less than the threshold, the updated value of the parameter is taken as the optimized value of the parameter.

11. A data classification device, characterized in that, The device includes: An acquisition and preparation module, configured to acquire data to be classified, prepare the quantum state of a first qubit to a first target state, and prepare the quantum state of a second qubit to a second target state representing the data to be classified; An input module for inputting the first target state and the second target state into a quantum neural network, the quantum neural network including a plurality of cascaded classification nodes, the input of the initial classification node among the plurality of cascaded classification nodes being the first target state and the second target state, and the input of the classification nodes other than the initial classification node among the plurality of cascaded classification nodes being the second target state and the quantum state of the first qubit output by the previous classification node; wherein, the classification node includes an alternating layer for evolving the quantum states of the first qubit and the second qubit based on a time evolution operator evolves, where i is the imaginary unit, is a Hamiltonian including a tensor product of a plurality of Pauli gates, t is time, and the alternating layer includes a verification module, a phase shift module, and a restoration module, wherein: the verification module includes a plurality of first CNOT gates, the control qubit of the first CNOT gate being the first qubit or the second qubit, and the target qubit of the first CNOT gate being an auxiliary qubit; the phase shift module includes a second RZ rotation gate, a first Pauli X gate, a third RZ rotation gate, and a second Pauli X gate that are cascaded in sequence and act on the auxiliary qubit, and the parameters of the second RZ rotation gate and the third RZ rotation gate are the time and the negative of the time respectively; the restoration module includes a plurality of second CNOT gates, the control qubit of the second CNOT gate being the first qubit or the second qubit, and the target qubit of the second CNOT gate being the auxiliary qubit; A measurement and conversion module, configured to measure the second qubit to obtain the output result of the quantum neural network, and convert the output result into a classification result.

12. A storage medium, characterized in that, A computer program is stored in the storage medium, wherein the computer program is configured to execute the method described in any one of claims 1 to 10 when running.

13. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method described in any one of claims 1 to 10.