3. Implementing quantum artificial neural networks on IBM's quantum computers

The development of quantum computing devices has opened up the possibility of transitioning from the purely theoretical approach to QUANNs to an experimental implementation of these networks. A particular example is IBM's quantum processors, available via cloud, under IBM Q Experience, using superconducting transmon quantum processing units.

The term transmon stands for transmission-line shunted plasma oscillation. A transmon qubit [11, 12] is an attempt at a technological implementation of a qubit for quantum computation, using superconductivity and Josephson junctions, gaining in charge noise insensitivity [11, 12]. The control, coupling, and measurement are implemented by means of microwave resonators and circuit quantum electrodynamics.

IBM has different transmon-based quantum computers in different locations around the world and provides access to these computers via cloud; this availability allows researchers to implement quantum experiments on actual quantum computers via cloud using IBM Q Experience, opening also the way for programmers to run algorithms on quantum computers by using the Python library Qiskit, which allows for the programmer to build quantum circuits in the Python code and manage the cloud-based access for simulation and experiments. The examples addressed in the present section all used Qiskit and two devices were employed: the "IBM Q 5 Tenerife" (ibmqx4)<sup>2</sup> and the "IBM Q 16 Melbourne"<sup>3</sup> (ibmq\_16\_melbourne).

The "IBM Q 5 Tenerife" device is a 5 qubit device with quantum registers labeled from Q0 to Q4, and the connectivity is, according to IBM, provided by two coplanar waveguide (CPW) resonators with resonances around 6.6 GHz (coupling Q2, Q3, and Q4) and 7.0 GHz (coupling Q0, Q1, and Q2).

The "IBM Q 16 Melbourne" device is a 14 qubit device with a connectivity that is, in turn, provided by a total of 22 CPW bus resonators each one connecting two quantum registers. For both the Tenerife and Melbourne devices, each quantum register also has a dedicated CPW readout resonator attached for control and readout.

From a computational model standpoint, we can treat the network connections and resulting quantum computing framework, provided by these physical devices, as a form of QUANN, where the conditional neural gates must obey the quantum device's basic topology in what regards the possible quantum controlled gates.

This is so because the quantum registers are linked in specific topologies that limit how conditional quantum operations are implemented; this is a main characteristic of QUANNs, namely, the conditional unitary gates implemented in neural computational circuits are dependent upon the topology and links between the different artificial neurons.

For the simplest algorithms, we can use just a few registers and connections, which means that each quantum device can simulate different QUANNs, within the restrictions of their respective topologies.

providing for an example of the importance of entanglement in the efficiency of quantum computation over classical computation, a point that was object of detailed discussion in [4] regarding the relevance of entanglement for quantum

The XOR Boolean function representation problem is such that we want an output neuron to fire when the input neurons' firing patterns are reversed and to remain nonfiring when the input neurons' firing patterns are aligned. This means that the neural network's output follows the XOR truth table with the output neuron

In this case, as shown in [4], the XOR function representation problem can be solved by a standard quantum feedforward neural network with no hidden layer, by

Formally, the quantum circuit, in the forward direction, can be represented by

<sup>U</sup>^ <sup>1</sup> <sup>¼</sup> <sup>U</sup>^ WH <sup>⊗</sup> <sup>U</sup>^ WH <sup>⊗</sup> <sup>1</sup>

^ <sup>þ</sup> j i<sup>1</sup> h j <sup>1</sup> <sup>⊗</sup> <sup>1</sup>

^ ⊗ 1

^ <sup>⊗</sup> j i <sup>0</sup> h j <sup>0</sup> <sup>⊗</sup> <sup>1</sup>

<sup>C</sup>^ <sup>¼</sup> <sup>U</sup>^ <sup>3</sup>U^ <sup>2</sup>U^ <sup>1</sup> (21)

^ (22)

^ <sup>þ</sup> ^<sup>1</sup> <sup>⊗</sup> j i<sup>1</sup> h j <sup>1</sup> <sup>⊗</sup> <sup>σ</sup>^<sup>1</sup> (24)

^ ⊗ σ^<sup>1</sup> (23)

firing when the XOR function evaluates to "True" and not firing otherwise.

taking advantage of quantum entanglement dynamics.

<sup>U</sup>^ <sup>2</sup> <sup>¼</sup> j i <sup>0</sup> h j <sup>0</sup> <sup>⊗</sup> <sup>1</sup>

<sup>U</sup>^ <sup>3</sup> <sup>¼</sup> <sup>1</sup>

with the gates, respectively, given by:

neural computational efficiency.

Figure 1.

Figure 2.

the following chain:

105

3.1 The XOR representation problem

IBM Q 16 Melbourne (ibmq\_16\_melbourne) connectivity structure.

Quantum Neural Machine Learning: Theory and Experiments

DOI: http://dx.doi.org/10.5772/intechopen.84149

IBM Q 5 Tenerife (ibmqx4) connectivity structure.

For a QUANN using all the quantum registers in the device, the types of algorithms are limited by the device structure, which can only implement a specific neural network topology and link direction.

In Figures 1 and 2, we, respectively, show the connectivity structure of the "IBM Q 5 Tenerife" and the "IBM Q 16 Melbourne" devices.

Having introduced the two devices, we now exemplify the theoretical and experimental implementation of a QUANN, on these devices, for a basic problem: the XOR Boolean function representation. This is a relevant example in the artificial neural network (ANN) literature, since the classical feedforward ANN needs a hidden layer to solve this problem, while its quantum counterpart does not [4].

Namely, a three-neuron QUANN with two input neurons feeding forward to a single output neuron is capable of representing the XOR function, while, in the classical case, we need an additional hidden layer comprised of two neurons. This is a feature of QUANNs that is generalizable to other Boolean functions as discussed in [4] regarding the computational efficiency of QUANNs over classical ANNs.

The reason for the greater efficiency is linked to entanglement, namely, the output neuron's firing dynamics can become entangled with the input layer's firing dynamics by way of the implementation of conditional NOT (CNOT) gates,

<sup>2</sup> The relevant elements on this processor, including the quantum circuit structure, can be consulted at the Qiskit backend website: https://github.com/Qiskit/qiskit-backend-information/tree/master/backend s/tenerife/V1 (consulted in 21/10/2018)

<sup>3</sup> The relevant elements on this processor, including the quantum circuit structure, can be consulted at the Qiskit backend website: https://github.com/Qiskit/qiskit-backend-information/blob/master/backend s/melbourne/V1/README.md (consulted in 21/10/2018).

Quantum Neural Machine Learning: Theory and Experiments DOI: http://dx.doi.org/10.5772/intechopen.84149

Figure 1. IBM Q 5 Tenerife (ibmqx4) connectivity structure.

run algorithms on quantum computers by using the Python library Qiskit, which allows for the programmer to build quantum circuits in the Python code and manage the cloud-based access for simulation and experiments. The examples addressed in the present section all used Qiskit and two devices were employed: the

The "IBM Q 5 Tenerife" device is a 5 qubit device with quantum registers labeled from Q0 to Q4, and the connectivity is, according to IBM, provided by two coplanar waveguide (CPW) resonators with resonances around 6.6 GHz (coupling Q2, Q3,

The "IBM Q 16 Melbourne" device is a 14 qubit device with a connectivity that is, in turn, provided by a total of 22 CPW bus resonators each one connecting two quantum registers. For both the Tenerife and Melbourne devices, each quantum register also has a dedicated CPW readout resonator attached for control and

From a computational model standpoint, we can treat the network connections and resulting quantum computing framework, provided by these physical devices, as a form of QUANN, where the conditional neural gates must obey the quantum device's basic topology in what regards the possible quantum controlled gates. This is so because the quantum registers are linked in specific topologies that limit how conditional quantum operations are implemented; this is a main characteristic of QUANNs, namely, the conditional unitary gates implemented in neural computational circuits are dependent upon the topology and links between the

For the simplest algorithms, we can use just a few registers and connections, which means that each quantum device can simulate different QUANNs, within the

For a QUANN using all the quantum registers in the device, the types of algorithms are limited by the device structure, which can only implement a specific

In Figures 1 and 2, we, respectively, show the connectivity structure of the "IBM

Having introduced the two devices, we now exemplify the theoretical and experimental implementation of a QUANN, on these devices, for a basic problem: the XOR Boolean function representation. This is a relevant example in the artificial neural network (ANN) literature, since the classical feedforward ANN needs a hidden layer to solve this problem, while its quantum counterpart does not [4]. Namely, a three-neuron QUANN with two input neurons feeding forward to a single output neuron is capable of representing the XOR function, while, in the classical case, we need an additional hidden layer comprised of two neurons. This is a feature of QUANNs that is generalizable to other Boolean functions as discussed in [4] regarding the computational efficiency of QUANNs over classical ANNs. The reason for the greater efficiency is linked to entanglement, namely, the output neuron's firing dynamics can become entangled with the input layer's firing dynamics by way of the implementation of conditional NOT (CNOT) gates,

<sup>2</sup> The relevant elements on this processor, including the quantum circuit structure, can be consulted at the Qiskit backend website: https://github.com/Qiskit/qiskit-backend-information/tree/master/backend

<sup>3</sup> The relevant elements on this processor, including the quantum circuit structure, can be consulted at the Qiskit backend website: https://github.com/Qiskit/qiskit-backend-information/blob/master/backend

"IBM Q 5 Tenerife" (ibmqx4)<sup>2</sup> and the "IBM Q 16 Melbourne"<sup>3</sup>

and Q4) and 7.0 GHz (coupling Q0, Q1, and Q2).

Artificial Intelligence - Applications in Medicine and Biology

(ibmq\_16\_melbourne).

different artificial neurons.

s/tenerife/V1 (consulted in 21/10/2018)

104

s/melbourne/V1/README.md (consulted in 21/10/2018).

restrictions of their respective topologies.

neural network topology and link direction.

Q 5 Tenerife" and the "IBM Q 16 Melbourne" devices.

readout.

Figure 2. IBM Q 16 Melbourne (ibmq\_16\_melbourne) connectivity structure.

providing for an example of the importance of entanglement in the efficiency of quantum computation over classical computation, a point that was object of detailed discussion in [4] regarding the relevance of entanglement for quantum neural computational efficiency.
