the cost function (vertical axis) of a 2-qubit unitary as a function of $\theta$ and $\phi$ (horizontal axes). The red line represents the path taken when carrying out gradient descent from a particular starting point.](grad_des_path.png){height="5.75cm"}

Scaling to bigger networks {#scaling-to-bigger-networks .unnumbered}
--------------------------

The same scheme can be used to make quantum generalisations of networks whose generalised neurons have more inputs/outputs and connections. FIG. \[fig:general\_neuron\] illustrates an $M$-qubit input quantum neuron with a subsequent $N$-qubit fan-out gate.

![\[fig:general\_neuron\] Diagram of the quantum generalisation of a classical neuron with $M$ inputs and $N$ outputs. The superscripts inside the square brackets of the unitaries represent the number of qubits the respective unitaries act on. $U^{[M+1]}$ is the unitary that represents the quantum neuron with an $N$-qubit input and $U^{[N]}$ is the fan-out gate that fans out the output in the final port of $U^{[M+1]}$ in a particular basis.](general_neuron.png){height="6cm"}

If one wishes the number of free parameters of a neuron to grow no more than polynomially in the number of inputs, one needs to restrict the unitary. It is natural to demand it to be a polynomial length circuit of some elementary universal gates, in particular if the input states are known to be 