# Using a Deep Quantum Neural Network to Enhance the Fidelity of Quantum Convolutional Codes
## 2 Basic Concepts
### Quantum Neural Network  
After decades of development, quantum neural networks have an important role in quantum pattern recognition, overcoming quantum noise, and improving the fidelity of quantum states. The QNN quantum neural network implements a true quantum analogue of classical neurons, which form quantum feedforward neural networks capable of general quantum computation. The effective training of these networks is described in neural network models using fidelity as a cost function, providing both classical and efficient quantum implementations. This approach allows for fast optimization with reduced memory requirements: the number of quantum bits required is scaled only according to the width,  
Figure 1: Circuit for encoding the first three qubits of a stream of quantum information with the 5-qubit convolutional code. allowing for deep network optimization. The neural network has significant generalization behavior for learning unknown unitary operators and is highly robust to noisy training data with low-dimensional quantum states. The minimal building block of QNN is a quantum perceptron, which is a quantum analogue of the perceptron used in classical machine learning. A quantum perceptron is an arbitrary unitary operator with \(m\) input qubits and \(n\) output qubits. These \((m+n)\) arbitrary qubits depend on \((2^{m+n})^{2}-1\) parameters. The input qubits are initialized in the possibly unknown mixed state \(\rho^{\text{ln}}\), and the output qubits are in the baseline product state \(|0\cdots 0\rangle_{\text{out}}\). Take the case of perceptrons acting on \(\mathrm{m}\) input qubits and one output qubit, i.e., there are \((m+1)\) unitary operators. A QNN is a quantum circuit composed of quantum perceptrons that are organized into \(L\) hidden layers that act on the initial input state \(\rho^{\text{ln}}\) and usually produce a mixed output state \(\rho^{\text{out}}\), with the following expression:  
\[\rho^{\text{out}}\,\equiv\,\text{tr}_{\text{in,\,\,hid}}\,\left(\mathcal{U} \left(\rho^{\text{in}}\,\otimes|0\cdots 0\rangle_{\text{hid,\,out}}\,\langle 0 \cdots 0|\right)\mathcal{U}^{\dagger}\right) \tag{6}\]  
where \(\mathcal{U}\equiv U^{\text{out}}\,U^{L}U^{L-1}\cdots U^{1}\) is the QNN circuit and \(U^{l}\) is the overall unitary operator of the \(l\)-th hidden layer, consisting of the product of quantum perceptrons acting on the \((l-1)\)-th layer and the \(l\)-th layer. Since the quantum perceptrons are independent unitary operators, they do not commute with each other and need to be operated in order. The overall QNN structure is shown in Figure 2; from left to right are the input layer, hidden layer and output layer, respectively. The quantum neural network has an input layer, an output layer, and L hidden layers, where perceptron units are applied layer by layer from top to bottom. The input quantum states are expanded in the hidden layer to fit a sufficient number of perceptron units, and then we reduce the dimension to keep them consistent with the number of input qubits before reaching the output layer. A key feature of a QNN is that the network output can be represented as a combination of a series of fully positive definite layer-to-layer transition mappings \(\mathcal{E}^{l}\), with the following expression:  
\[\rho^{\text{out}}\,=\mathcal{E}^{\text{out}}\,\left(\mathcal{E}^{L}\left( \ldots\mathcal{E}^{2}\left(\mathcal{E}^{1}\left(\rho^{\text{in}}\right) \right)\ldots\right)\right) \tag{7}\]  
\[\mathcal{E}^{l}\left(X^{l-1}\right)\equiv\text{tr}_{l-1}\left(\prod_{j=m_{j}} ^{l}U_{j}^{l}\left(X^{l-1}\otimes|0\cdots 0\rangle_{l}\langle 0\cdots 0|\right) \prod_{j=1}^{m_{l}}U_{j}^{l^{\dagger}}\right) \tag{8}\]  
Figure 2: The structure of a QNN circuit. where \(U_{j}^{l}\) is the \(j\)-th perceptron acting on the \((l-1)\)-th and \(l\)-th layers, and \(m_{l}\) is the total number of perceptrons acting on the \((l-1)\)-th and \(l\)-th layers. The information is propagated from the input to the output, thus naturally implementing the quantum feedforward neural network.