all images having a particular support or number of atoms (sparsity). The details of these two constraint sets only enter the algorithm through the action of two *constraint projections*, $P_A$ and $P_B$. These provide exact solutions of two global subproblems: for arbitrary $x$, find points $x_A=P_A(x)\in A$ and $x_B=P_B(x)\in B$ on the two constraint sets that are proximal to $x$.

Importing the methodology of phase retrieval to neural networks is mostly about formulating the training problem as an instance of for suitable $A$ and $B$, with the additional property that the corresponding constraint projections can be computed efficiently. Before we preview our approach to this, we describe a general-purpose algorithm for solving and contrast it with gradient descent.

We will train neural networks with the *relaxed-reflect-reflect* (RRR) algorithm, probably the simplest of the algorithms that are successful in phase retrieval. Both RRR and the stochastic gradient descent (SGD) algorithm are iterative with a time-step (learning rate) parameter $\beta$. In the limit $\beta\to 0$ both methods define a flow: $$\label{flow}
\dot{x}=F(x).$$ In SGD $x$ is the vector of network parameters and the vector field $F$ is the gradient of the loss (including regularization terms) with respect to those parameters. In the 