The following python code uses the nlopt library to train a qonn (quantum optical neural net) to learn the fuctionality of a CNOT gate:
import numpy as np import