@yuichirominato 2019.02.18更新 260views

[Neuron] Understanding an artificial neuron on quantum circuit.


Introduction

An Italian team implemented the artificial neuron on IBM machine like the paper below. Let’s check and learn the theory.

An Artificial Neuron Implemented on an Actual Quantum Processor
Francesco Tacchino,1, ∗ Chiara Macchiavello,1, 2, 3, † Dario Gerace,1, ‡ and Daniele Bajoni4, §
https://arxiv.org/pdf/1811.02266.pdf

Outline

The circuit it self is very simple. Instead of using a neural network model like (a) in the figure, now we use Ui for input and Uw for recognition. Finally we have ccx for activation function.

https://arxiv.org/pdf/1811.02266.pdf

Finally through the ancilla bit we have 0 or 1 value recognized the image.

The circuit

https://arxiv.org/pdf/1811.02266.pdf

Let’s understand the circuit. Now we can recognize 16 image on 2 qubits. I wrote the binary pattern below.

Steps

The whole step is,

  1. Making superposition with H gate
  2. Input of data with Z and CZ gate
  3. Recognition of data with Z and CZ gate
  4. Apply H gate again for restoring the data to Z axis and apply X gate to invert all 0 qubits to 1 for next step.
  5. Using ccz or controlled z gate for recognition if you have all 1 the pattern is identify.

One example of 2qubits circuit is like,

First we have state vector after applying H gate on both qubits.

$$\left( \begin{array}{c} 1 \\ 1 \\ 1 \\ 1 \end{array} \right)$$

Applying tensor products of I and Z for state vector,

$$I \otimes Z = \left( \begin{array}{c} 1&0&0&0 \\ 0&-1&0&0 \\ 0&0&1&0 \\ 0&0&0&-1 \end{array} \right)$$

and we have the state vector as,

$$\left( \begin{array}{c} 1 \\ -1 \\ 1 \\ -1 \end{array} \right)$$

And CZ gate,

$$CZ = \left( \begin{array}{c} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&1&0 \\ 0&0&0&-1 \end{array} \right)$$

Finally we have input of pattern 11 as 1,-1,1,1

$$\left( \begin{array}{c} 1 \\ -1 \\ 1 \\ 1 \end{array} \right)$$

Recognition circuit and activation function

Also as next step recognition function of 11 implemented. If you have the same circuit as input all of qubits will be 0.

Finally X gate will apply for all qubits to have 1 or 0 value for activation function of controlled Z gate.

On Blueqat

Let’s see it on blueqat.

https://github.com/mdrft/Blueqat

Insallation

pip install blueqat

If you are using jupyter or google colab, please add ! in front of pip

from blueqat import Circuit
Circuit(3).h[:2].z[1].cz[0,1].z[:2].cz[0,1].h[:2].x[:2].ccx[0,1,2].m[2].run(shots=100)

finally we have

ounter({'000': 100})

We get 0 for recognition. This shows that we have different pattern for input and recognition circuit.

Circuit(3).h[:2].z[1].cz[0,1].z[1].cz[0,1].h[:2].x[:2].ccx[0,1,2].m[2].run(shots=100)

now we have

Counter({'001': 100})

If we have 1, the pattern match to the circuit.

Discussion

This model is very primitive and not a big circuit can implemented. The main idea is to make [1,1,1,1] state vector with H gate and apply Z or CZ to marking the qubits reversing it’s phase. We can implement totally 2^2^N qubits with only N qubits.


Back To Top