method is identified: global gradient descent for a quantum generalisation of the cost function, a function evaluating how close the outputs are to the desired outputs. To illustrate the ability of the quantum network we apply it to (i) compressing information encoded in superpositions onto fewer qubits (an autoencoder) and (ii) re-discovering the quantum teleportation protocol—this illustrates that the network can work out QIP protocols given only the task. To make the connection to physics clear we describe how to simulate and train the network with quantum photonics.

We proceed as follows. Firstly, we describe the recipe for generalising the classical neural network. Then it is demonstrated how the network can be applied to the tasks mentioned above, followed by a design of a quantum photonic realisation of a neural module. We discuss the results, followed finally by a summary and outlook.

Quantum neural networks {#quantum-neural-networks .unnumbered}
=======================

Classical neural networks are composed of elementary units called neurons. We begin with describing these, before detailing how to generalise them to quantum neurons.

The classical neuron {#the-classical-neuron .unnumbered}
--------------------

A classical neuron is depicted in FIG. \[fig:classical\_neuron\]. In this case, it has two inputs (though there could be more). There is 