Train a state preparation circuit#

The circuit ansatz is predefined. We can train the parameters in the ansatz to prepare an arbitrary state from the inintial all zero state.

The gradients are obtained with backpropagation.

python train_state_prep.py