Implementation Method, Device, Electronic Device and Storage Medium of Quantum Fully Connected Network

A quantum full connection network addresses inefficiencies in classical computing by employing quantum circuits to encode and perform full connection operations, thereby reducing computational complexity and enhancing efficiency.

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

Patent Information

Application Number
CN202111444198.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2025-07-15
Estimated Expiration
2041-11-30

AI Technical Summary

Technical Problem

In the prior art, the computational volume of fully connected neural network models is large, resulting in waste of computing resources and low computing efficiency.

Method used

A quantum fully connected network is used to build a quantum fully connected model through quantum lines, and a quantum logic gate is used to encode and fully connect feature information to reduce the amount of calculation and improve computing efficiency.

Benefits of technology

The simulation of the fully connected layer is realized, which reduces the computational volume and improves the computing efficiency, especially when processing image, language and voice data, which significantly improves the processing speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116361961B_ABST
    Figure CN116361961B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, electronic device, and storage medium for implementing a quantum fully connected network. The method includes: obtaining feature information of a target object, inputting the feature information into a pre-trained quantum fully connected model, where the quantum fully connected model is constructed by a quantum circuit, and the circuit parameters in the quantum circuit are determined by the feature information and a preset corresponding relationship, running the quantum circuit and performing measurements, and outputting a fully connected result corresponding to the feature information. By adopting the embodiments of the present application, the simulation of the fully connected layer can be realized according to quantum technology, the amount of calculation is reduced, and the calculation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of quantum computing, and particularly relates to a method, apparatus, electronic device, and storage medium for implementing a quantum fully connected network. 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] In the field of classical computers, the fully connected neural network model can be used in fields such as image recognition, language data processing, and speech recognition, aiming to extract feature information from information carriers such as images, languages, and speeches. Taking the fully connected layer in a neural network as an example, the input of the fully connected layer is N and the output is M. The number of multiplication and addition operations it calculates is both M * N. Taking the input dimension of the extracted features as 1024 and the output dimension as 10, 10240 addition operations and 10240 multiplication operations are required. It can be seen that when the dimension reaches a certain value, the required amount of calculation is large, resulting in a waste of computing resources.

[0004] Application Content

[0005] The purpose of this application is to provide a method, apparatus, electronic device, and storage medium for implementing a quantum fully connected network to solve the deficiencies in the prior art. It can simulate the fully connected layer according to quantum technology, reduce the amount of calculation, and improve the calculation efficiency.

[0006] In a first aspect, an embodiment of this application provides a method for implementing a quantum fully connected network, including:

[0007] Obtain the feature information of the target object;

[0008] Input the feature information into a pre-trained quantum fully connected model, where the quantum fully connected model is constructed by a quantum circuit, and the circuit parameters in the quantum circuit are determined by the feature information and a preset corresponding relationship;

[0009] Run the quantum circuit and perform measurements, and output the fully connected result corresponding to the feature information.

[0010] Optionally, the circuit parameters include: a first parameter and a second parameter, and the quantum circuit includes:

[0011] A quantum state encoding sub - circuit including a first preset quantum logic gate, where the quantum state encoding sub - circuit is used to encode the feature information onto a quantum state, and a first parameter of the first preset quantum logic gate is determined according to the feature information;

[0012] A quantum fully - connected sub - circuit including a second preset quantum logic gate, where the quantum fully - connected sub - circuit is used to perform a fully - connected operation on the encoded quantum state information, and a second parameter of the second preset quantum logic gate is determined from the preset corresponding relationship according to the feature information.

[0013] Optionally, the pre - trained quantum fully - connected model is trained in the following way:

[0014] Construct a quantum circuit including a quantum state encoding sub - circuit and a quantum fully - connected sub - circuit;

[0015] Obtain the feature information of the training object and input the feature information into the quantum circuit. The first parameter of the quantum circuit is determined according to the feature information, and the second parameter is currently a preset initial training value;

[0016] Run the current quantum circuit, measure the quantum state of the quantum bits at the preset positions of the current quantum circuit, and output the fully - connected result corresponding to the training object;

[0017] Compare the fully - connected result with a preset expected value. If the fully - connected result does not reach the preset expected value, use a preset training algorithm to iterate the second parameter until the calculated fully - connected result reaches the preset expected value;

[0018] Take the quantum circuit containing the iterated second parameter as the trained quantum fully - connected model.

[0019] Optionally, after using the preset training algorithm to iterate the second parameter, the method further includes:

[0020] Record the feature information, the second parameter, and the fully - connected result obtained according to the feature information and the second parameter in each iteration process to form the preset corresponding relationship, and the preset corresponding relationship is used to determine the second parameter according to the feature information and the fully - connected result.

[0021] Optionally, the target object and the training object are one of image data, language data, and voice data.

[0022] Optionally, the output of the fully - connected result corresponding to the feature information includes:

[0023] Run a quantum circuit that includes the first parameter and the second parameter indicating the completion of iteration, and output the quantum state corresponding to the feature information;

[0024] Measure the quantum state of the qubits at the preset positions in the quantum circuit, and determine the probability that the measured quantum state is the |1> state as the fully connected result corresponding to the feature information.

[0025] Optionally, the output of the fully connected result corresponding to the feature information includes:

[0026] Run a quantum circuit that includes the first parameter and the second parameter indicating the completion of iteration, and output the quantum state corresponding to the feature information;

[0027] Measure the quantum state of the qubits at the preset positions in the quantum circuit, and determine the measurement expectation of the quantum state as the fully connected result corresponding to the feature information.

[0028] In a second aspect, an implementation device of a quantum fully connected network provided by an embodiment of the present application includes:

[0029] An acquisition unit configured to acquire feature information of a target object;

[0030] An input unit configured to input the feature information into a pre-trained quantum fully connected model, where the quantum fully connected model is constructed by a quantum circuit, and the circuit parameters in the quantum circuit are determined by the feature information and a preset corresponding relationship;

[0031] A running unit configured to run the quantum circuit and perform measurements, and output a fully connected result corresponding to the feature information.

[0032] In a third aspect, an electronic device provided by an embodiment of the present application includes a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and are configured to be executed by the processor, and the programs include instructions for performing the steps in the method described in the first aspect of the embodiments of the present application.

[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute some or all of the steps described in the method described in the first aspect of the embodiments of the present application.

[0034] Fifth aspect, an embodiment of the present application provides a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in the method according to the first aspect of the embodiments of the present application. This computer program product can be a software installation package.

[0035] Sixth aspect, an embodiment of the present application provides a quantum computer operating system, where the quantum computer operating system processes the implementation of the quantum fully connected network according to some or all of the steps described in the method according to the first aspect of the embodiments of the present application.

[0036] Compared with the prior art, the present application obtains the feature information of the target object, inputs the feature information into a pre-trained quantum fully connected model, where the quantum fully connected model is constructed by quantum circuits, and the circuit parameters in the quantum circuits are determined by the feature information and a preset corresponding relationship, runs the quantum circuits and performs measurements, and outputs a fully connected result corresponding to the feature information. Using the embodiments of the present application can simulate the fully connected layer according to quantum technology, reduce the amount of calculation, and improve the calculation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a schematic diagram of the implementation method flow of the quantum fully connected network provided by the embodiment of the present application;

[0038] Figure 2 It is another schematic diagram of the implementation method flow of the quantum fully connected network provided by the embodiment of the present application;

[0039] Figure 3 It is still another schematic diagram of the implementation method flow of the quantum fully connected network provided by the embodiment of the present application;

[0040] Figure 4-a It is a circuit schematic diagram of a quantum encoding sub-circuit provided by the embodiment of the present application;

[0041] Figure 4-b It is a circuit schematic diagram of a quantum fully connected sub-circuit provided by the embodiment of the present application;

[0042] Figure 4-c It is another circuit schematic diagram of a quantum fully connected sub-circuit provided by the embodiment of the present application;

[0043] Figure 5 It is a schematic diagram of the implementation device of the quantum fully connected network provided by the embodiment of the present application;

[0044] Figure 6 It is a hardware structure block diagram of a computer terminal for the implementation method of the quantum fully connected network provided by the embodiment of the present application. Specific embodiments

[0045] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and should not be construed as a limitation of the present application.

[0046] An embodiment of the present application provides a method for implementing a quantum fully connected network to solve the deficiencies in the prior art. It can simulate the fully connected layer according to quantum technology, reduce the computational amount, and improve the computational efficiency.

[0047] It should be noted that the quantum program referred to in the embodiments of the present application is a program written in a classical language that represents qubits and their evolution, and corresponding classical codes are used for qubits, quantum logic gates, etc. related to quantum computing.

[0048] 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 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. The display mode of a quantum circuit can be a sequence of quantum logic gates arranged in a certain execution time sequence.

[0049] 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 connected by time, that is, the state of qubits evolves naturally over time. During this process, according to the instructions of the Hamiltonian operator, it is not until it encounters a quantum logic gate that it is operated on.

[0050] A whole quantum program corresponds to a total quantum circuit. The quantum program described in the present application refers to this total quantum circuit. Among them, 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 control flow nodes (jump instructions). A quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution process of a quantum program is the 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.

[0051] 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 through quantum logic gates. 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 (or single quantum logic gates, simply referred to as "single 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-qubit quantum logic gates (or two-quantum logic gates, simply referred to as "double gates"), such as the CNOT gate, CR gate, SWAP gate, ISWAP gate, etc.; multi-qubit quantum logic gates (or multi-quantum logic gates, simply referred to as "multi gates"), such as the 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 multiplying the unitary matrix on the left by the matrix corresponding to the quantum state right vector. For example, the vector corresponding to the quantum state right vector |0> is The vector corresponding to the quantum state right vector |1> is

[0052] A quantum state, that is, the logical state of a qubit. In a quantum algorithm (or quantum program), for the quantum states of a group of qubits included in a quantum circuit, a binary representation method is adopted. For example, a group of qubits are q0, q1, q2, representing the 0th, 1st, and 2nd qubits. In the binary representation method, they are sorted from the highest bit to the lowest bit as q2q1q0. The total number of quantum states corresponding to this group of qubits is 2 to the power of the total number of qubits, that is, 8 eigenstates (definite states): |000>, |001>, |010>, |011>, |100>, |101>, |110>, |111>. The bits of each quantum state correspond to the qubits consistently. For example, for the |001> state, 001 corresponds to q2q1q0 from the highest bit to the lowest bit, and | > is the Dirac symbol. For a quantum circuit containing N qubits q0, q1, …, q n 、…、q N-1 The bit-order sorting of the binary representation of the quantum state for the quantum circuit is q N-1 q N-2 …、q1q0.

[0053] Taking a single qubit as an example, the logical state ψ of a single qubit may be in the |0> state, |1> state, or a superposition state (uncertain state) of the |0> state and the |1> state, and can be specifically expressed as ψ = a|0> + b|1>, where a and b are complex numbers representing the amplitudes (probability amplitudes) of the quantum state. The square of the modulus of the amplitude represents the probability, |a| 2 、|b| 2respectively represent the probabilities of the logical states being |0> state and |1> state, |a| 2 +|b| 2 = 1. In short, a quantum state is a superposition state composed of eigenstates. When the probabilities of other states are 0, it is in a uniquely determined eigenstate.

[0054] Next, the implementation method process of the quantum fully connected network of this application will be further introduced. Specifically, please refer to Figure 1 , a schematic diagram of the implementation method process of the quantum fully connected network provided by the embodiments of this application includes:

[0055] 101. Obtain the feature information of the target object;

[0056] Specifically, the target object may include, but is not limited to: image data, language data or voice data. For example, each frame of an image in a video, a separately taken picture, the language text in a chat record, voice information, etc. Feature information refers to the information that carries and reflects the implicit features of the target object. Taking an image as an example, the feature information of the image includes: pixel information, contour information, color information, label information, etc. Feature values are the specific data values corresponding to the feature information. For example: pixel values, label values, etc.

[0057] Exemplarily, when the target object is an image, the feature information is pixel information, and the feature value is a pixel value. This image can be concretely represented as data in a specific digital form. The image data is a matrix, and each element of the matrix is a pixel value. In practical applications, a set of pixel values of the image data matrix can be received each time, and the number of pixel values in this set is set by the user according to specific requirements. Alternatively, the feature values extracted by the previous layer network of the fully connected layer can be received.

[0058] 102. Input the feature information into a pre-trained quantum fully connected model. The quantum fully connected model is constructed by quantum circuits, and the circuit parameters in the quantum circuits are determined by the feature information and a preset corresponding relationship;

[0059] Specifically, the quantum circuit includes a quantum state encoding sub-circuit of a first preset quantum logic gate, and the quantum state encoding sub-circuit is used to encode the feature information onto the quantum state.

[0060] The quantum circuit further includes a quantum fully connected sub-circuit of a second preset quantum logic gate, and the quantum fully connected sub-circuit is used to perform a fully connected operation on the encoded quantum state information. The quantum circuit formed by combining the quantum state encoding sub-circuit and the quantum fully connected sub-circuit is used as the quantum fully connected model. Among them, the circuit parameters of the quantum circuit may include a first parameter and a second parameter.

[0061] Before the specific use of the quantum fully connected model, it needs to be trained in advance. During the implementation process of the quantum fully connected model after training, first, the first parameter of the first preset quantum logic gate is determined according to the input feature information, and the second parameter of the second preset quantum logic gate can be directly determined according to the training. Preferably, it can also be determined from the preset corresponding relationship according to the feature information. Then, the quantum circuit with the currently determined circuit parameters is run to obtain the fully connected result. It should be noted that the preset corresponding relationship can be obtained during the training process of the pre - quantum fully connected model.

[0062] Specifically, the first preset quantum logic gate in the quantum state encoding sub - circuit can be a rotation logic gate, such as one or more combinations of the RX gate, RY gate, and RZ gate. There is no limit on the logic gate order, specifically including: the RX gate; the RY gate; the RZ gate; the RX gate and the RY gate; the RX gate and the RZ gate; the RY gate and the RZ gate; the RX gate, the RY gate, and the RZ gate. It should be noted that the logic gates set on each qubit in the encoding sub - circuit are the same.

[0063] Among them, the first parameter value can be: the arctangent value of the corresponding eigenvalue or the arctangent value of the square, and it can also be calculated by a preset formula. For example, the first parameter value = eigenvalue * π / 2, etc.

[0064] Exemplarily, a set of eigenvalues are 4 pixel values x1, x2, x3, x4. The encoding sub - circuit includes 4 qubits, and the first preset quantum logic gate on each qubit is the RY gate. Calculate the first parameter values in the 4 RY gates, which are θ1 = x1 * π / 2, θ2 = x2 * π / 2, θ3 = x3 * π / 2, θ4 = x4 * π / 2 respectively.

[0065] Another exemplarily, a set of eigenvalues are 4 pixel values x1, x2, x3, x4. The encoding sub - circuit includes 4 qubits, and the first preset quantum logic gate on each qubit is a combination of the RY gate and the RZ gate. Calculate the first parameter values in the 4 RY gates, which are the arctangent values arctan x1, arctan x2, arctan x3, arctan x4 of the corresponding eigenvalues respectively; calculate the first parameter values in the 4 RZ gates, which can be the arctangent values of the squares of the corresponding eigenvalues respectively

[0066] As Figure 4-a shown, the RY gate and the RZ gate on each of the four qubit lines together form the quantum state encoding sub - circuit. The first parameter values in the 4 RY gates are the arctangent values arctan x1, arctan x2, arctan x3, arctan x4 of the corresponding eigenvalues respectively; calculate the first parameter values in the 4 RZ gates, which can be the arctangent values of the squares of the corresponding eigenvalues respectively

[0067] Specifically, the quantum fully connected sub-circuit may include a second preset quantum logic gate that partly contains variable parameters and partly contains invariable parameters, that is, the second parameters include: variable parameters and invariable parameters.

[0068] Exemplarily, the second preset quantum logic gate containing variable parameters may be, for example, Figure 4-b the RY gate shown, and the second preset quantum logic gate containing invariable parameters may be, for example, Figure 4-b the CNOT gate shown acting on two non-adjacent qubits, etc. Among them, for the second preset quantum logic gate containing variable parameters, when the quantum fully connected model has not been trained yet, the corresponding second parameter value is determined through training. As Figure 4-b shown, the RY gate and the CNOT gate on the five-qubit circuit together form the quantum fully connected sub-circuit. It should be noted that during the process of implementing a single quantum full connection, the number of qubits in the fully connected sub-circuit module is the same as the number of qubits in the encoding sub-circuit module.

[0069] 103. Run the quantum circuit and perform measurements, and output the full connection result corresponding to the feature information.

[0070] Specifically, measure the quantum state of the preset qubit in the quantum circuit, and determine the probability that the measured quantum state is the |1> state as the full connection result corresponding to the feature information. Alternatively, measure the quantum state of the preset qubit in the quantum circuit, and use the measurement expectation of the quantum state as the full connection result corresponding to the feature information.

[0071] Exemplarily, Figure 4-b is a schematic diagram of a quantum fully connected sub-circuit. The encoding method of the quantum encoding sub-circuit and the type of the preset quantum logic gate are not limited. If with the Figure 4-a shown encoding method and adding an identical qubit connected in front to Figure 4-b , then a matrix for a 4*6 input may be:

[0072] [[0.37454012,0.95071431,0.73199394,0.59865848,0.15601864,0.15599452],[1.37454012,0.95071431,0.73199394,0.59865848,0.15601864,0.15599452],[1.37454012,1.95071431,0.73199394,0.59865848,0.15601864,0.15599452],[1.37454012,1.95071431,1.73199394,1.59865848,0.15601864,0.15599452]]

[0073] And the parameters of the RY gate are respectively: x1 = 1.374640, x2 = 1.950814, x3 = 1.732094, x4 = 1.598758, x5 = 0.156095, x6 = 0.156119;

[0074] Each time a set of 1*6 data is input, and it is input four times. Each time, the first two qubits are measured multiple times. The measurement operation of a set of data can obtain the probability that the first two qubits are in the |1> state. A total of 8 data are obtained, and a 4*2 matrix can be formed as follows:

[0075] [[0.0590705127,0.1264582723],[0.5157099962,0.1264582723],[0.5157099962,0.1443066299],[0.9382225275,0.1443066299]]

[0076] It can be seen that the 4*6 matrix is reduced in dimension through quantum full connection to obtain a 4*2 matrix, and this matrix is used as the result of the full connection.

[0077] Furthermore, the full connection result can also be obtained according to the measurement expectation of the qubits. If a certain quantum full connection network performs 10,000 measurement operations in total, among which the number of times the |1> state is measured is 5762 times, and the number of times the |0> state is measured is 4238 times, then the full connection result can also be:

[0078] (1 * 5762 + 0 * 4238) / 10000 = 0.5762

[0079] The quantum fully-connected layer operation performs a fully-connected operation on classical data using a quantum circuit. It does not require calculating multiplication and addition operations. Instead, it only needs to encode the data into a quantum state and then perform evolution operations and measurements through the quantum circuit to obtain the final fully-connected result. The complexity of this quantum operation can reach O(log(N)), thus greatly improving the computing efficiency.

[0080] In this embodiment, the feature information of the target object is obtained, and the feature information is input into a pre-trained quantum fully-connected model. Among them, the quantum fully-connected model is constructed by a quantum circuit, and the circuit parameters in the quantum circuit are determined by the feature information and a preset corresponding relationship. The quantum circuit is run and measured to output a fully-connected result corresponding to the feature information. Using the embodiment of the present application can simulate the fully-connected layer according to quantum technology, reduce the amount of calculation, and improve the computing efficiency.

[0081] Based on Figure 1 , the present application further explains the steps of training the quantum fully-connected model. For details, please refer to Figure 2 , specifically, another schematic diagram of the implementation method flow of the quantum fully-connected network provided by the embodiment of the present application includes:

[0082] 201. Construct a quantum circuit including a quantum state encoding sub-circuit and a quantum fully-connected sub-circuit;

[0083] 202. Obtain the feature information of the training object and input the feature information into the quantum circuit. The first parameter of the quantum circuit is determined according to the feature information, and the second parameter is currently a preset initial training value;

[0084] 203. Run the current quantum circuit, measure the quantum state of the quantum bits at the preset positions of the current quantum circuit, and output a fully-connected result corresponding to the training object;

[0085] 204. Compare the fully-connected result with a preset expected value. If the fully-connected result does not reach the preset expected value, use a preset training algorithm to iterate the second parameter until the calculated fully-connected result reaches the preset expected value;

[0086] 205. Use the quantum circuit containing the iterated second parameter as the trained quantum fully-connected model.

[0087] Specifically, when constructing a quantum circuit including a quantum state encoding sub-circuit and a quantum fully-connected sub-circuit, the construction method of the quantum state encoding sub-circuit can be a combination of RY gates and RZ gates as shown in Figure 4-a , or a combination of X gates and H gates. The quantum fully-connected sub-circuit can be a combination of RY gates and CNOT gates as shown in Figure 4-b , or asFigure 4-c The combination of the U1 gate and the CNOT gate shown is not limited to a specific construction method. Among them, the unitary matrix of the U1 gate is:

[0088]

[0089] Among them, θ is the rotation angle, which can be iterated according to the training process of the model as shown in the foregoing method or matched from the preset corresponding relationship according to the feature information.

[0090] Furthermore, the data types of the training object and the target object are the same, and both can be one of image data, language data, and voice data. The first parameter included in the quantum state encoding sub-circuit is determined according to the feature information of the training object. When the second parameter of the quantum fully connected sub-circuit is not trained, it can be set to an initial training value, and the initial training value can be a random number or a fixed value set by the user.

[0091] Run the quantum circuit and measure. Exemplarily, as described in the foregoing Embodiment 103, if the obtained 4*2 matrix meets the preset value requirement, stop the iteration and use the x1-x6 as the parameters of the six RY gates as shown in Figure 4-b If the preset value requirement is not met, the parameters of the six RY gates can be iterated according to a preset algorithm. The specific preset algorithm can be an iterative algorithm such as the gradient descent algorithm. Use the second parameter that meets the preset value requirement as the parameter of the preset quantum logic gate, and use the quantum circuit including the iterated second parameter as the trained quantum fully connected model.

[0092] Based on Figure 2 , this application further explains the steps of training the quantum fully connected model. For details, please refer to Figure 3 . Specifically, another schematic diagram of the implementation method flow of the quantum fully connected network provided by the embodiments of this application includes:

[0093] 204. Compare the fully connected result with a preset expected value. If the fully connected result does not reach the preset expected value, use a preset training algorithm to iterate the second parameter until the calculated fully connected result reaches the preset expected value;

[0094] 301. Record the feature information, the second parameter, and the fully connected result obtained according to the feature information and the second parameter in each iteration process to form the preset corresponding relationship.

[0095] In the embodiments of the present application, when training a quantum fully connected model, it is not only to seek the optimal parameters that can minimize the input feature information, but also to record the feature information, the second parameters, and the fully connected results in each iteration of the training model, so as to form the corresponding relationship between different fully connected results output by the feature information according to different second parameters. When the trained quantum fully connected model receives the feature information to be processed, according to the feature information and the pre-recorded corresponding relationship, during the use of the quantum full connection, the corresponding parameters are matched for the preset quantum logic gates with variable parameters in the quantum circuit, so as to achieve the function of flexibly processing different feature information. Exemplarily, during the iteration process of training the quantum fully connected model, the above corresponding relationship is recorded in a table, with the feature information as the index. According to the index, the optimal parameters for reducing the feature information to the lowest dimension, or the parameters corresponding to different fully connected results of the feature information, can be queried to achieve the function of full connection.

[0096] It can be seen that the present application obtains the feature information of the target object, inputs the feature information into a pre-trained quantum fully connected model, wherein the quantum fully connected model is constructed by a quantum circuit, and the circuit parameters in the quantum circuit are determined by the feature information and a preset corresponding relationship. The quantum circuit is run and measured to output the fully connected result corresponding to the feature information. By adopting the embodiments of the present application, the simulation of the fully connected layer can be realized according to quantum technology, the amount of calculation is reduced, and the calculation efficiency is improved. Moreover, on the basis of using quantum technology to achieve full connection, the corresponding fully connected parameters are matched for the input data according to its feature information, making the processing method more flexible.

[0097] The above content introduces the present invention from the perspective of the method. Next, the present invention will be further introduced from the perspective of the device. For details, please refer to Figure 5 , including:

[0098] An obtaining unit 501, configured to obtain the feature information of the target object;

[0099] An input unit 502, configured to input the feature information into a pre-trained quantum fully connected model, wherein the quantum fully connected model is constructed by a quantum circuit, and the circuit parameters in the quantum circuit are determined by the feature information and a preset corresponding relationship;

[0100] An operating unit 503, configured to run the quantum circuit and perform measurement, and output the fully connected result corresponding to the feature information.

[0101] It can be seen that the acquisition unit 501 is configured to acquire the feature information of the target object, and the input unit 502 is configured to input the feature information into a pre-trained quantum fully-connected model, where the quantum fully-connected model is constructed by a quantum circuit, and the circuit parameters in the quantum circuit are determined by the feature information and a preset corresponding relationship. The operation unit 503 is configured to operate the quantum circuit and perform measurements to output a fully-connected result corresponding to the feature information.

[0102] The following takes the operation on a computer terminal as an example for a detailed description. Figure 6 The hardware structure block diagram of a computer terminal for an implementation method of a quantum fully-connected network provided by an embodiment of the present invention is shown in Figure 6 As shown, the computer terminal may include one or more ( Figure 6 only one is shown in the figure) processors 601 (the processor 601 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 602 for storing data. Optionally, the above computer terminal may further include a transmission device 603 for communication functions and an input / output device 604. Those of ordinary skill in the art can understand that Figure 6 the structure shown in the figure 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 those shown in Figure 6 the figure, or have a different configuration from that shown in Figure 6 the figure.

[0103] The memory 602 can be used to store software programs and modules of application software, such as program instructions / modules corresponding to the implementation method of the quantum fully-connected network in the embodiments of the present application. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602, that is, implements the above method. The memory 602 may include a high-speed random access memory, and may further 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 602 may further include a memory remotely disposed relative to the processor 601, 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.

[0104] The transmission device 603 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 603 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 603 may be a Radio Frequency (RF) module, which is used to communicate with the Internet wirelessly. An embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute some or all of the steps of any of the methods described in the above method embodiments, and the above computer includes an electronic device.

[0105] An embodiment of the present application also provides a computer program product. The above computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above computer program is operable to enable a computer to execute some or all of the steps of any of the methods described in the above method embodiments. The computer program product may be a software installation package, and the above computer includes an electronic device.

[0106] An embodiment of the present application also provides a quantum computer, which includes a quantum computer operating system. The quantum computer operating system implements the implementation process of the quantum fully connected network according to some or all of the steps of any of the methods described in the above method embodiments.

[0107] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.

[0108] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0109] In several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the above division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.

[0110] The units described above as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0111] In addition, in each embodiment of the present application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0112] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the above methods in each embodiment of the present application. And the aforementioned memory includes: various media such as USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), mobile hard disks, magnetic disks, or optical discs that can store program codes.

[0113] The above has introduced the embodiments of the present application in detail. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A method for implementing a quantum fully connected network, characterized in that, Including: Obtain the feature information of the target object; Input the feature information into a pre-trained quantum fully-connected model, which is constructed by a quantum circuit. The quantum circuit includes a quantum state encoding sub-circuit and a quantum fully-connected sub-circuit. The quantum state encoding sub-circuit contains a first preset quantum logic gate for encoding the feature information onto a quantum state, and the first parameter of the first preset quantum logic gate is determined according to the feature information. The quantum fully-connected sub-circuit contains a second preset quantum logic gate for performing a fully-connected operation on the encoded quantum state, and the second parameter of the second preset quantum logic gate is determined from a preset corresponding relationship according to the feature information. The preset corresponding relationship is formed by recording the feature information, the second parameter, and the fully-connected result obtained according to the feature information and the second parameter in each iteration process; Run the quantum circuit and perform measurements to output the fully-connected result corresponding to the feature information.

2. The method according to claim 1, wherein The pre-trained quantum fully-connected model is obtained through the following training method: Construct a quantum circuit including a quantum state encoding sub-circuit and a quantum fully-connected sub-circuit; Obtain the feature information of the training object and input the feature information into the quantum circuit. The first parameter of the quantum circuit is determined according to the feature information, and the second parameter is currently a preset initial training value; Run the current quantum circuit, measure the quantum state of the quantum bits at the preset positions of the current quantum circuit, and output the fully-connected result corresponding to the training object; Compare the fully-connected result with a preset expected value. If the fully-connected result does not reach the preset expected value, use a preset training algorithm to iterate the second parameter until the calculated fully-connected result reaches the preset expected value; Take the quantum circuit containing the iterated second parameter as the trained quantum fully-connected model.

3. The method according to claim 1 or 2, characterized in that, The target object and the training object are one of image data, language data, and voice data.

4. The method according to claim 2, characterized in that, The output of the fully-connected result corresponding to the feature information includes: Run the quantum circuit containing the first parameter and the iterated second parameter, and output the quantum state corresponding to the feature information; Measure the quantum state of the preset qubit in the quantum circuit to determine that the measured quantum state is The probability of the state, as the fully connected result corresponding to the characteristic information.

5. The method according to claim 2, wherein The output of the fully-connected result corresponding to the feature information includes: Run the quantum circuit containing the first parameter and the iterated second parameter, and output the quantum state corresponding to the feature information; Measure the quantum state of the quantum bits at the preset positions in the quantum circuit to determine the measurement expectation of the quantum state as the fully-connected result corresponding to the feature information.

6. An implementation device for quantum full connection, characterized in that, Including: An acquisition unit for acquiring the feature information of the target object; An input unit for inputting the feature information into a pre-trained quantum fully-connected model, where the quantum fully-connected model is constructed by a quantum circuit, and the quantum circuit includes a quantum state encoding sub-circuit and a quantum fully-connected sub-circuit; the quantum state encoding sub-circuit includes a first preset quantum logic gate for encoding the feature information onto a quantum state, and a first parameter of the first preset quantum logic gate is determined according to the feature information; the quantum fully-connected sub-circuit includes a second preset quantum logic gate for performing a fully-connected operation on the encoded quantum state, and a second parameter of the second preset quantum logic gate is determined from a preset corresponding relationship according to the feature information, and the preset corresponding relationship is formed by recording the feature information, the second parameter, and the fully-connected result obtained according to the feature information and the second parameter in each iteration process. An operation unit for operating the quantum circuit and performing measurements, and outputting a fully-connected result corresponding to the feature information.

7. An electronic device, characterized in that, It includes a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and are configured to be executed by the processor, and the programs include instructions for performing the steps in the method according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Image classification method and related device

    CN110909796A

  • Image recognition system and method based on quantum convolutional neural network

    CN113361664A