How to scale the QGAN example to more qubits

AH! :man_facepalming: There is a way to simply increase the number of qubits. Sorry! Let me backpedal.

Everything I said about the dimensions needing to match (i.e., the generator needs to generate 8x8 = 64 unit features) is still correct. However, the patch method’s architecture can be moulded to your liking. The nuances I was glossing over are actually quite important :sweat_smile:.

Given N_G sub-generators that make up the entire generator, N qubits, and N_A ancillary qubits, the size of each sub-generator’s output (patch_size) is 2^{N - N_A}. So, when all of the sub-generators are recombined / concatenated together, that cumulative output needs to be 8x8.

In the tutorial, we have N_G = 4, N = 5, and N_A = 1. Each sub-generator will create a feature whose length is 2^{5 - 1} = 2^4 = 16. 4 groups of 16 gives us 64 — the dimensionality we need!

However, I could easily do N_G = 4, N = 6, and N_A = 2 and the math still checks out (you can try this). You could even do N_G = 16, N = 5, and N_A = 3.

Here’s the magic formula you can use: 2^{N - N_A} = \frac{64}{N_G}. If that equation holds, then those values of N_G, N, and N_A will work.

Sorry about that! Hopefully that clears things up, but please let me know if you’re still confused!

1 Like