Some background: I'm currently running the same training algorithm with a classical neural network and a quantum circuit, respectively. The NN is implemented in Keras with a TensorFlow backend, the circuit is implemented in TFQ.

My circuit has only 4 qubits and 88 trainable parameters, and training is still at least a factor 10 slower than training a NN with two dense layers (10 units each) and 182 trainable parameters. (All hyperparameters are identical.) At this moderate circuit size I don't expect circuit training to be that much slower than training the classical NN.

Looking at the CPU usage, I see that TFQ uses all cores, but only to a fraction. My suspicion is that the circuit is too small to reach the threshold where multiprocessing makes sense, so this might be a source of the slowness. However, I can't seem to find a way to turn multiprocessing off.

Question: Is there a way to disable multiprocessing in TensorFlow Quantum?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.