A data generation method and device based on quantum circuits
The quantum circuit-based data generation method addresses the resource-intensive challenges of classical data repair by utilizing quantum computing's parallel processing to enhance efficiency and precision in data restoration tasks.
Patent Information
- Application Number
- CN202110922749.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-12
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-08-12
AI Technical Summary
In the field of classical computing, image repair requires a lot of computing power and storage resources, and it is difficult for the existing technology to efficiently repair data.
The data generation method based on quantum circuit is adopted, and the repaired data is generated by receiving target data and inputting pre-trained parameter-containing sub-lines, running and measuring the quantum circuit.
Taking advantage of the parallel advantages of quantum computing, save computing and storage resources and achieve efficient data repair results.
Smart Images

Figure CN115705495B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of quantum computing, and particularly relates to a data generation method and device based on a quantum circuit. Background Art
[0002] A quantum computer is a physical device that follows the laws of quantum mechanics to perform high-speed mathematical and logical operations, store, and process quantum information. When a device processes and calculates quantum information and runs quantum algorithms, it is a quantum computer. Due to its relatively more efficient ability to process mathematical problems compared to ordinary computers, for example, it can accelerate the time to crack RSA keys from hundreds of years to a few hours, quantum computers have become a key technology under research.
[0003] Currently, if data is not properly stored, it will be damaged, resulting in losses that cannot be repaired. To save such losses, data repair technology has emerged. Taking image repair as an example, repair refers to the technology of restoring the lost parts of an image and reconstructing them based on background information. In the digital image world, it refers to applying complex algorithms to replace the missing or damaged parts of image data. It has a wide range of applications in various directions such as repairing and filling cracks, scratches, and defective areas in old photos; removing dates, watermarks on photos; removing unwanted image content and filling the vacancies left after removal with reasonable image content, such as in the fields of face repair, simulated repair of murals in Tang tombs, video watermark removal, etc.
[0004] However, in the field of classical computing, processing image repair requires consuming a large amount of computing power and storage resources, which is an urgent problem to be solved. Summary of the Invention
[0005] The purpose of the present invention is to provide a data generation method and device based on a quantum circuit to solve the deficiencies in the prior art. It can realize the generation of data based on quantum computing technology and be applied to data repair to save computing and storage resources.
[0006] An embodiment of the present application provides a data generation method based on a quantum circuit, and the method includes:
[0007] Receiving first target data;
[0008] Inputting the first target data into a parameterized quantum circuit for data generation that has been pre-trained;
[0009] Running and measuring the parameterized quantum circuit, and generating second target data corresponding to the first target data according to the measurement result of the parameterized quantum circuit.
[0010] Optionally, the first target data includes: data to be repaired, and the second target data includes: repaired data.
[0011] Optionally, the parametric quantum circuit includes: a quantum initialization sub-circuit for parameter initialization, a quantum amplitude encoding sub-circuit for data encoding, and a quantum entanglement sub-circuit for quantum entanglement.
[0012] Optionally, the quantum amplitude encoding sub-circuit includes: a first parametric quantum logic gate, and the unitary matrix of the first parametric quantum logic gate includes: a first parameter;
[0013] The step of inputting the first target data into a pre-trained parametric quantum circuit for data generation includes:
[0014] Determining a first parameter value of the first parameter according to the first target data;
[0015] Inputting the first parameter value into the corresponding first parametric quantum logic gate.
[0016] Optionally, the step of running and measuring the parametric quantum circuit and generating second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit includes:
[0017] Running the parametric quantum circuit, measuring the qubits included in the parametric quantum circuit, and obtaining the quantum states and probabilities of the qubits;
[0018] Generating second target data corresponding to the first target data according to the quantum states and probabilities.
[0019] Optionally, the method further includes:
[0020] Inputting the second target data into a pre-trained classical neural network to generate third target data corresponding to the second target data.
[0021] Another embodiment of the present application provides a data generation device based on a quantum circuit, the device includes:
[0022] A receiving module, configured to receive first target data;
[0023] An input module, configured to input the first target data into a pre-trained parametric quantum circuit for data generation;
[0024] A first generation module, configured to run and measure the parametric quantum circuit, and generate second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit.
[0025] Another embodiment of the present application provides a storage medium, in which a computer program is stored, and the computer program is configured to execute the method described in any one of the above when running.
[0026] Another embodiment of the present application 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 method described in any one of the above.
[0027] Compared with the prior art, a data generation method based on quantum circuits provided by the present invention receives first target data, inputs the first target data into a parameterized quantum circuit for data generation that has been pre-trained, runs and measures the parameterized quantum circuit, and generates second target data corresponding to the first target data according to the measurement result of the parameterized quantum circuit. Thus, it can realize data generation based on quantum computing technology, be applied to data repair, give play to the parallel advantage of quantum computing, save computing and storage resources, and fill the gaps in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a hardware structure block diagram of a computer terminal for a data generation method based on quantum circuits provided by an embodiment of the present invention;
[0029] Figure 2 It is a schematic flow chart of a data generation method based on quantum circuits provided by an embodiment of the present invention;
[0030] Figure 3 It is a schematic diagram of a quantum amplitude encoding sub-circuit provided by an embodiment of the present invention;
[0031] Figure 4 It is a schematic diagram of a quantum entanglement sub-circuit provided by an embodiment of the present invention;
[0032] Figure 5 It is a schematic diagram of a parameterized quantum circuit provided by an embodiment of the present invention;
[0033] Figure 6 It is a schematic diagram of a discriminator network provided by an embodiment of the present invention;
[0034] Figure 7 It is a schematic structural diagram of a data generation device based on quantum circuits provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] The embodiments described below with reference 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.
[0036] The embodiments of the present invention first provide a data generation method based on quantum circuits, which can be applied to electronic devices, such as computer terminals, specifically, ordinary computers, quantum computers, etc.
[0037] The following takes the operation 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 for a data generation method based on quantum circuits provided by the embodiments of the present invention. As Figure 1 shown, the computer terminal may include one or more ( Figure 1 only one is shown in the figure) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the above 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 above computer terminal. For example, the computer terminal may further include more or fewer components than Figure 1 shown in the figure, or have a different configuration from Figure 1 shown in the figure.
[0038] The memory 104 can be used to store software programs and modules of application software, such as program instructions / modules corresponding to the data generation method based on quantum circuits 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 memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely set relative to the processor 102, and these remote memories can be connected to the computer terminal through a network. Examples of the above network include, but are not limited to, the Internet, enterprise intranets, local area networks, mobile communication networks, and combinations thereof.
[0039] 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 adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station and thus can 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.
[0040] It should be noted that a real quantum computer has a hybrid structure, which consists of 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 achieve quantum computing. A quantum program is a sequence of instructions written in a quantum language such as the QRunes language that can run on a quantum computer, enabling support for quantum logic gate operations and ultimately achieving quantum computing. Specifically, a quantum program is a series of instruction sequences that operate on quantum logic gates in a certain time sequence.
[0041] In practical applications, due to limitations in 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. Usually, 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 qubits and their evolution, where qubits, quantum logic gates, etc. related to quantum computing are all represented by corresponding classical codes.
[0042] 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, representing a circuit for operating on qubits under an abstract concept. Its composition includes qubits, a circuit (timeline), and various quantum logic gates. Finally, the result often needs to be read out through a quantum measurement operation.
[0043] 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 a qubit naturally evolves over time and is operated according to the instructions of the Hamiltonian operator until it encounters a logic gate.
[0044] A whole quantum program corresponds to a total quantum circuit. The quantum program referred to in the present invention means this total quantum circuit, where the total number of qubits in the total quantum circuit is the same as the total number of qubits in the quantum program. It can be understood that a quantum program can be composed of a quantum circuit, a measurement operation for the qubits 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.
[0045] 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 the 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 the quantum state. Quantum logic gates are the basis for constructing quantum circuits. Quantum logic gates include single-bit 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.; two-bit or multi-bit quantum logic gates, such as the CNOT gate, CR gate, CZ 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 quantum state right vector.
[0046] See Figure 2 , Figure 2 FIG. is a schematic flowchart of a data generation method based on a quantum circuit provided by an embodiment of the present invention, which may include the following steps:
[0047] S201, receive first target data;
[0048] Specifically, the first target data may include: data to be repaired, and the second target data may include: repaired data.
[0049] For example, the data to be repaired is an image to be repaired, and the repaired data is a repaired image. The image to be repaired is an incomplete image with partial pixel loss, which can be manifested as an image missing a certain area. The image to be repaired may be an image containing certain identification features. Exemplarily, a face image or an animal image can both be used as a kind of image to be repaired. Because a face image includes the facial features of a person, and there are certain regularities in the positional relationship of the facial features, and there are also certain regularities in the image of an animal. According to this regularity, the missing pixels can be repaired to obtain the repaired image.
[0050] The following takes the first target data as an image to be repaired as an example for detailed description, which does not limit the present application.
[0051] S202, input the first target data into a parameterized quantum circuit for data generation that has been pre-trained;
[0052] Specifically, a parameterized quantum circuit means that the unitary matrix of the quantum logic gate in the quantum circuit contains parameters (variable parameters). The parameterized quantum circuit may include: a quantum initialization sub-circuit for parameter initialization, a quantum amplitude encoding sub-circuit for data encoding, and a quantum entanglement sub-circuit for quantum entanglement.
[0053] Among them, the number of qubits n of the parametric quantum circuit is determined by the number of pixels m contained in the image to be repaired. Specifically, n = [log2m]. For example, if the image to be repaired contains 1024 pixels, the parametric quantum circuit requires at least 10 qubits. Moreover, the number of qubits of the sub-circuit is consistent with that of the parametric quantum circuit.
[0054] Exemplarily, the role of the quantum initialization sub-circuit is parameter initialization during training. That is, when training the parametric quantum circuit, the parameter values of the unitary matrix of the logic gates in this sub-circuit can be randomly initialized. A quantum initialization sub-circuit U(init) can include: RY gates, where the quantum logic gates on each qubit are the same, namely RY gates; or, another U(init) includes: RX gates, RY gates, and RZ gates, where the quantum logic gates on each qubit are the same, namely RX gates, RY gates, and RZ gates in sequence. Among them, the unitary matrices of the RX gate, RY gate, and RZ gate are respectively:
[0055]
[0056]
[0057]
[0058] Among them, the parameter θ is the rotation angle.
[0059] Specifically, the quantum amplitude encoding sub-circuit U(input) is used to encode the pixels of the image to be repaired and can include: a first parametric quantum logic gate, and the unitary matrix of the first parametric quantum logic gate includes: a first parameter;
[0060] Inputting the first target data into the pre-trained parametric quantum circuit for data generation, the first parameter value of the first parameter can be determined according to the first target data; inputting the first parameter value into the corresponding first parametric quantum logic gate.
[0061] Exemplarily, an idea for constructing the amplitude encoding sub-circuit is to split it from top to bottom all the time and implement it with a series of controlled rotation gates. For example, the RY gate is used as the first parametric quantum logic gate, and the rotation angle parameter of the unitary matrix of the RY gate is the first parameter. The specific implementation process can be as follows:
[0062] Principle formula:
[0063]
[0064] The quantum logic gates used:
[0065]
[0066] Implementation of the RY gate:
[0067] RY(θ)|0〉 = cos(θ / 2)|0〉 + sin(θ / 2)|1〉
[0068] Assume that the pixel values of the image to be repaired are \(b = [b_0, b_1, b_2, b_3, b_4, b_5, b_6, b_7]\). Then the process of realizing pixel amplitude encoding is as follows:
[0069] 1. Determine the number of qubits 3 qubits are required, and the initial state is assumed to be |000〉.
[0070] 2. Divide the pixel data into two groups. Take the square root of the sum of the squares of the 4 data in each group as the amplitude value, and encode it onto the amplitude of the quantum state of the first qubit through 1 RY gate (denoted as RY(θ1)), obtaining:
[0071]
[0072] 3. Further split the two groups of data obtained in the previous step to get 4 groups of data, each group having two data. Take the square root of the sum of the squares of each group of data as the amplitude value, and encode it onto the 4 amplitudes of the first two qubits through 2 controlled RY gates, obtaining:
[0073]
[0074]
[0075] 4. According to the idea of the previous step, continue to split the data, and 8 groups of data will be obtained. Through 4 controlled RY gates, the amplitude encoding of 3 qubits and a total of 8 quantum states is realized:
[0076]
[0077]
[0078]
[0079]
[0080] For the amplitude encoding of 8 pixels, it can be realized through the above steps. The final quantum amplitude encoding sub - circuit is as Figure 3 shown. Among them, the RY gate and the hollow and / or solid connection lines represent controlled RY gates. The solid represents real - control, that is: when the quantum state of the qubit where the solid is located is the |1〉 state, the RY gate is executed; the hollow represents virtual - control, that is: when the quantum state of the qubit where the hollow is located is the |0〉 state, the RY gate is executed.
[0081] For the RY(θ1) gate, the evolution of the above - mentioned quantum state is realized by the RY(θ1) gate:
[0082]
[0083] Obtained:
[0084]
[0085]
[0086] Furthermore:
[0087]
[0088] The rotation angle parameters θ2... θ7 of the remaining RY gates can be obtained in the same way, thus realizing the step of determining the first parameter value of the first parameter according to the first target data.
[0089] Specifically, the quantum entanglement sub-circuit can be set to one or more. Similar to increasing the number of layers of a deep neural network, increasing the number (depth) enables the circuit to represent more complex structures and increases the number of parameters.
[0090] Among them, as Figure 4 shown, a quantum entanglement sub-circuit U(θ) can include: a CR gate that realizes entanglement between different qubit positions, and the CR gate acts on two adjacent qubit positions (the last CR gate acts on the last qubit and the first qubit); and a U3 gate that realizes quantum correction, and the unitary matrix of the U3 gate is:
[0091]
[0092] where i represents the imaginary part in complex numbers, α represents the deflection angle of rotation along the x-axis, β represents the deflection angle of rotation along the y-axis, and γ represents the deflection angle of rotation along the z-axis.
[0093] It should be noted that the U3 gate on each qubit can be equivalently replaced by a combination of RX gates, RY gates, and RZ gates. Alternatively, another quantum entanglement sub-circuit can include: RZ gates and RY gates. The composition of the logic gates included in the above quantum initialization sub-circuit, quantum amplitude encoding sub-circuit, and quantum entanglement sub-circuit is only an example and constitutes a limitation on the parametric quantum circuit. Finally, a schematic diagram of a parametric quantum circuit composed of U(init), U(input), and U(θ) can be as Figure 5 shown, and a series of icons at the rightmost end represent measurement operations.
[0094] S203, run and measure the parametric quantum circuit, and generate second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit.
[0095] Specifically, the parametric quantum circuit can be run to measure the qubits included in the parametric quantum circuit, so as to obtain the quantum states of the qubits and their probabilities; and second target data corresponding to the first target data can be generated according to the quantum states and their probabilities.
[0096] Exemplarily, it is assumed that the image to be repaired contains 1024 pixels, and the parametric quantum circuit includes 10 qubits. Quantum measurement operations are performed on all qubits of the parametric quantum circuit to obtain 1024 quantum states of the 10 qubits, and each quantum state corresponds to a probability. 1024 pixel values of the repaired image are determined according to the 1024 probability values (for example, directly using the 1024 probability values as the corresponding 1024 pixel values), and the repaired image is generated.
[0097] The training process of the parametric quantum circuit will be described below.
[0098] In one implementation, the parametric quantum circuit can be used as a quantum generator (network), combined with a first discriminator (network), to form a first generative adversarial network for training:
[0099] First, the parameters are randomly initialized through the quantum generator, and the training data (fake data) of the quantum generator is obtained through the parameterized quantum generator. The real data (original image) and the fake data are input into the first discriminator, and the generator network and the first discriminator are backpropagated by comparing the loss function, so as to update the corresponding network parameters. The generator and the first discriminator modules are alternately executed until the error between the output of the generator and the target meets the requirements, that is, until the first discriminator cannot identify the data source. At this time, the Nash equilibrium state is reached.
[0100] Specifically, after the construction of the quantum generator is completed, the generated data (fake data) of the quantum generator can be obtained. After the generated data passes through the discriminator, the difference from the real data is obtained, and the loss function is calculated according to the difference. The loss function of the quantum generator is:
[0101]
[0102] where D φ represents the first discriminator, m represents the number of data, and g l represents the data sample from the quantum generator (the generated data output). By calculating the gradient of the loss function for all weights in the network, the gradient is fed back to the optimization method (such as the Adam optimization algorithm), so as to update the weights to minimize the loss function.
[0103] The gradient calculation method of the parameters is shown in the following formula:
[0104]
[0105] Among them, f(x; θ i ) can be understood as a quantum generator function. Specifically, it is the probability value measured by the quantum generator corresponding to the current input of x (pixel value) and θ i . Here, x is the input pixel value, and θ i is the parameter to be updated in the unitary matrix of the quantum logic gate. is the gradient.
[0106] The parameter update method can be as follows:
[0107]
[0108] Among them, η is the learning rate. The selection of η is related to the convergence of the network iteration. Usually, the learning rate is initialized to 0.001 and will actually be adjusted according to the convergence of the network. For example, if it converges in the initial stage of training (such as after 3 rounds of training), it means that this value is too large and needs to be relatively reduced; if it has not converged by the later stage of training (such as after 30 rounds of training), it means that the convergence speed is too slow and needs to be relatively increased.
[0109] Exemplarily, the structure of a first discriminator is as Figure 6 shown, including fully connected layers and activation function layers that are alternately stacked. The activation function can be leakyReLU or sigmoid. Among them, each node of the fully connected layer is connected to all nodes of the previous layer. The activation function leakyReLU is used for non-linear processing, and the activation function sigmoid is used to map the non-linearized result to a value between 0 and 1. 0 indicates that the input is fake data, and 1 indicates that the input is real data.
[0110] Specifically, construct the backpropagation architecture of the first discriminator network, and the corresponding loss function is as follows:
[0111]
[0112] Among them, x l represents m random samples selected from the training dataset, where l = 1,..., m. By calculating the gradient of the loss function for all weights in the discriminator network and according to the parameter update method, the gradient is fed back to the optimization method (such as the Adam optimization algorithm) to update the weights to minimize the loss function.
[0113] Specifically, in practical applications, the second target data can also be input into a pre-trained classical neural network to generate the third target data corresponding to the second target data. Among them, the second target data is the repaired image output by the quantum generator, and the third target data is the image (the second repaired image) that further repairs the repaired image (the first repaired image) output by the classical neural network, which can achieve more accurate repair of the image.
[0114] Exemplarily, the classical neural network can be the Completion Network in the classical GLCIC network (Globally and Locally Consistent Image Completion), as the classical generation network (classical generator).
[0115] Those skilled in the art can understand that the classical GLCIC network (the second generative adversarial network) contains two main Networks: the Completion Network and the Discriminator. The Completion Network can be regarded as a classical generator, and the Discriminator network is used as the second discriminator. The Discriminator also contains two sub-discriminators, the global discriminator and the local discriminator. These two sub-discriminators are used to ensure that the generated image conforms to the global semantics and, at the same time, tries to improve the clarity and contrast of the local area as much as possible. Using the Completion Network as the generator and the Discriminator as the second discriminator for generative adversarial training, the trained Completion Network can further repair the input quantum repair map (i.e., the image repaired by the parametric quantum circuit) to obtain a repaired image that is closer to, for example, a real human face portrait.
[0116] During the training process of the classical GLCIC network, the main loss functions used are the BCELoss loss function and the MSE_loss loss function. Among them, the MSE loss function is:
[0117]
[0118] The BCELoss loss function is:
[0119] loss(x i , y i ) = -w i [y i logx i + (1 - y i ) log(1 - x i )
[0120] Among them, y i represents the real data, and x i represents the predicted data (the output data of the classical generator), and i represents the i-th data.
[0121] In another implementation, a parametric quantum circuit can also be used as a quantum generator. By combining the classical generator and the second discriminator in the above classical GLCIC network, a quantum generative adversarial network model (QGAN, Quantum Generative Adversarial Networks) is formed, and the quantum generator and the classical generator are trained together without separately training the quantum generator through the first discriminator. This model is a classical-quantum hybrid architecture. The quantum generator is used to preliminarily repair the image, and the classical generator can further repair the repaired image, realizing the accurate repair of the image by the quantum-classical hybrid generation network. Moreover, by utilizing the parallel computing acceleration advantage of quantum computing, the complexity can be reduced and the computing speed can be improved; storing more data with a small number of qubits can also reduce the resource consumption.
[0122] It can be seen that by receiving the first target data, inputting the first target data into a pre-trained parametric quantum circuit for data generation, running and measuring the parametric quantum circuit, and generating the second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit, the generation of data can be realized based on quantum computing technology, applied to data repair, giving play to the parallel advantage of quantum computing, saving computing and storage resources, and filling the gaps in related technologies.
[0123] See Figure 7 , Figure 7 which is a schematic structural diagram of a data generation device based on a quantum circuit provided by an embodiment of the present invention, corresponding to the Figure 2 shown process. The device includes:
[0124] A receiving module 701, configured to receive the first target data;
[0125] An input module 702, configured to input the first target data into a pre-trained parametric quantum circuit for data generation;
[0126] A first generation module 703, configured to run and measure the parametric quantum circuit, and generate the second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit.
[0127] Specifically, the first target data includes: data to be repaired, and the second target data includes: repaired data.
[0128] Specifically, the parametric quantum circuit includes: a quantum initialization sub-circuit for parameter initialization, a quantum amplitude encoding sub-circuit for data encoding, and a quantum entanglement sub-circuit for quantum entanglement.
[0129] Specifically, the quantum amplitude encoding sub-circuit includes: a first parametric quantum logic gate, and the unitary matrix of the first parametric quantum logic gate includes: a first parameter;
[0130] The input module is specifically configured to:
[0131] Determine a first parameter value of the first parameter according to the first target data;
[0132] Input the first parameter value into the corresponding first parametric quantum logic gate.
[0133] Specifically, the generation module is specifically configured to:
[0134] Run the parametric quantum circuit, measure the qubits included in the parametric quantum circuit, and obtain the quantum states and probabilities of the qubits;
[0135] Generate second target data corresponding to the first target data according to the quantum states and probabilities.
[0136] Specifically, the apparatus further includes:
[0137] A second generation module, configured to input the second target data into a pre-trained classical neural network to generate third target data corresponding to the second target data.
[0138] It can be seen that by receiving the first target data, inputting the first target data into a pre-trained parametric quantum circuit for data generation, running and measuring the parametric quantum circuit, and generating second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit, it is possible to realize data generation based on quantum computing technology, apply it to data repair, give play to the parallel advantage of quantum computing, save computing and storage resources, and fill the gaps in related technologies.
[0139] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, and the computer program is set to execute the steps in any one of the above method embodiments when running.
[0140] Specifically, in this embodiment, the above storage medium can be set to store a computer program for executing the following steps:
[0141] S1, receive the first target data;
[0142] S2, input the first target data into a pre-trained parametric quantum circuit for data generation;
[0143] S3, run and measure the parametric quantum circuit, and generate second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit.
[0144] 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., all kinds of media that can store computer programs.
[0145] An embodiment of the present invention further provides an electronic device, including 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 steps in any one of the above method embodiments.
[0146] 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.
[0147] Specifically, in this embodiment, the above processor may be configured to execute the following steps through a computer program:
[0148] S1, receive the first target data;
[0149] S2, input the first target data into a pre-trained parametric quantum circuit for data generation;
[0150] S3, run and measure the parametric quantum circuit, and generate second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit.
[0151] The above has detailed the structure, features and effects of the present invention according to the illustrated embodiments. 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 into equivalent changes, should still be within the protection scope of the present invention when they do not exceed the spirit covered by the specification and the drawings.
Claims
1. A data generation method based on quantum circuits, characterized in that, The method includes: Receiving first target data; the first target data includes: data to be repaired; Inputting the first target data into a parameterized quantum circuit for data generation that has been pre-trained, where the parameterized quantum circuit includes: a quantum initialization sub-circuit for parameter initialization, a quantum amplitude encoding sub-circuit for encoding the data to be repaired, and a quantum entanglement sub-circuit for quantum entanglement; the quantum logic gates on each qubit in the quantum initialization sub-circuit are the same; the quantum amplitude encoding sub-circuit includes a first parameterized quantum logic gate, and the unitary matrix of the first parameterized quantum logic gate includes: a first parameter; the first parameter value of the first parameter is determined according to the first target data and input into the corresponding first parameterized quantum logic gate; the quantum entanglement sub-circuit includes a first quantum logic gate for realizing entanglement between different qubit positions and a second quantum logic gate for quantum repair, the first quantum logic gate acts on two adjacent qubit positions, and there is a first quantum logic gate acting on the first qubit and the last qubit; among them, the parameterized quantum circuit is used as a quantum generator and is trained together with a first discriminator to form a first generative adversarial network; Running and measuring the parameterized quantum circuit, and generating second target data corresponding to the first target data according to the measurement result of the parameterized quantum circuit, where the second target data includes: repaired data.
2. The method according to claim 1, wherein, The running and measuring the parameterized quantum circuit, and generating second target data corresponding to the first target data according to the measurement result of the parameterized quantum circuit includes: Running the parameterized quantum circuit, measuring the qubits included in the parameterized quantum circuit, and obtaining the quantum states and their probabilities of the qubits; Generating second target data corresponding to the first target data according to the quantum states and their probabilities.
3. The method according to claim 1, wherein The method further includes: Inputting the second target data into a pre-trained classical neural network to generate third target data corresponding to the second target data; the third target data includes: data obtained by repairing the repaired data again.
4. A data generation device based on a quantum circuit, characterized in that, The device includes: A receiving module, configured to receive first target data; the first target data includes: data to be repaired; An input module for inputting the first target data into a pre-trained parametric quantum circuit for data generation, the parametric quantum circuit including: a quantum initialization sub-circuit for parameter initialization, a quantum amplitude encoding sub-circuit for encoding data to be repaired, and a quantum entanglement sub-circuit for quantum entanglement; the quantum logic gates on each qubit in the quantum initialization sub-circuit are the same; the quantum amplitude encoding sub-circuit includes a first parametric quantum logic gate, and the unitary matrix of the first parametric quantum logic gate includes: a first parameter; the first parameter value of the first parameter is determined according to the first target data and input into the corresponding first parametric quantum logic gate; the quantum entanglement sub-circuit includes a first quantum logic gate for realizing entanglement between different qubit positions and a second quantum logic gate for realizing quantum repair, the first quantum logic gate acts on two adjacent qubit positions, and there is a first quantum logic gate acting on the first qubit and the last qubit; wherein, the parametric quantum circuit is used as a quantum generator and is trained in combination with a first discriminator to obtain a first generative adversarial network. A first generation module for running and measuring the parametric quantum circuit, and generating second target data corresponding to the first target data according to the measurement result of the parametric quantum circuit, the second target data including: repaired data.
5. 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 according to any one of claims 1 to 3 when running.
6. 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 according to any one of claims 1 to 3.
Citation Information
Patent Citations
Quantum generative adversarial network algorithm based on conditional constraints
CN111814907A