followed by a fan-out of its output. We add as an extra desideratum that the compressed bit, the output of $U_1$, is diagonal in the computational basis. The final neurons have the task of recreating $\ket{in_{12}}$ on the outputs labelled 6 and 8 respectively. The result is shown in FIG. \[fig:quantum\_autoencoder\].

![\[fig:quantum\_autoencoder\]Neural network implementing a quantum autoencoder that can accomodate two input qubits that are entangled. The blue box represents the quantum compression device after training.](curly_212_autoencoder_u_f.png){height="3.2cm"}

This means that a natural and simple cost function is $$C=\sum_{j=0, k=0}^3 (\mathrm{Tr}(\rho_{6,8}\sigma_{j}\otimes \sigma_{k}) - \mathrm{Tr}(\rho_{in_{1,2}}\sigma_{j}\otimes \sigma_{k}))^{2}.$$ Training is then conducted via global gradient descent of the cost w.r.t. the $\alpha_{j_{1},...,j_{N}}$ parameters, as defined in Eq. \[eq:learningruleq\]. During the training the network was fed states from the given input set, picked independently and identically for each step (i.i.d). Standard speed-up techniques for learning were used, e.g. a momentum term [@Azoff94; @Nielsen15]. In training with a variety of 2 possible orthogonal input states including superposition states, the cost function of the quantum autoencoder converged towards zero through global gradient descent in every case, starting with uniformly randomised weights, $\alpha_{j_{1},...,j_{N}} \in [-1,1]$. For 2 non-orthogonal inputs and a 1-qubit bottleneck the cost-function will not converge to 