# How to scale the QGAN example to more qubits

**URL:** <https://discuss.pennylane.ai/t/how-to-scale-the-qgan-example-to-more-qubits/2958>\
**Category:** PennyLane Help\
**Created:** [May 21, 2023, 4:11am UTC](https://discuss.pennylane.ai/t/how-to-scale-the-qgan-example-to-more-qubits/2958 "2023-05-21T04:11:11Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![isaacdevlugt](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/isaacdevlugt/32/1159_2.png) [@isaacdevlugt](https://discuss.pennylane.ai/u/isaacdevlugt)\
**Post date:** [May 24, 2023, 6:23pm UTC](https://discuss.pennylane.ai/t/how-to-scale-the-qgan-example-to-more-qubits/2958/11 "2023-05-24T18:23:22Z")

</div>

AH! 🤦‍♂️ 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 😅.

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!

---

_[View the full topic](https://discuss.pennylane.ai/t/how-to-scale-the-qgan-example-to-more-qubits/2958)._
