From aba2eaa621f5fc3eb31369fccb0789d60b986d60 Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Wed, 3 Sep 2025 14:43:29 +0530 Subject: [PATCH 1/3] Fix: Convert set to list for random.sample() for Python 3.11 compatibility --- tensorflow_quantum/python/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_quantum/python/util.py b/tensorflow_quantum/python/util.py index 006dce8bd..dab705082 100644 --- a/tensorflow_quantum/python/util.py +++ b/tensorflow_quantum/python/util.py @@ -113,7 +113,7 @@ def _apply_random_control(gate, all_qubits): if n_open == 0: # No open qubits to control. Return unmodified gate. return gate - control_locs = random.sample(open_qubits, n_open) + control_locs = random.sample(list(open_qubits), n_open) control_values = random.choices([0, 1], k=n_open) # TODO(tonybruguier,#636): Here we call the parent's class controlled_by # because Cirq's breaking change #4167 created 3-qubit gates that cannot be From a33d17d43aac553b78cdef5c31940c099097d7d1 Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Wed, 3 Sep 2025 16:14:25 +0530 Subject: [PATCH 2/3] Fix typos in research_tools.ipynb --- docs/tutorials/research_tools.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tutorials/research_tools.ipynb b/docs/tutorials/research_tools.ipynb index fcb39d3c4..e388e0f9a 100644 --- a/docs/tutorials/research_tools.ipynb +++ b/docs/tutorials/research_tools.ipynb @@ -71,7 +71,7 @@ "TensorFlow Quantum brings quantum primitives into the TensorFlow ecosystem. Now quantum researchers can leverage tools from TensorFlow. In this tutorial you will take a closer look at incorporating [TensorBoard](https://www.tensorflow.org/tensorboard) into your quantum computing research. Using the [DCGAN tutorial](https://www.tensorflow.org/tutorials/generative/dcgan) from TensorFlow you will quickly build up working experiments and visualizations similar to ones done by [Niu et al.](https://arxiv.org/pdf/2010.11983.pdf). Broadly speaking you will:\n", "\n", "1. Train a GAN to produce samples that look like they came from quantum circuits.\n", - "2. Visualize the training progress as well as distribuion evolution over time.\n", + "2. Visualize the training progress as well as distribution evolution over time.\n", "3. Benchmark the experiment by exploring the compute graph." ] }, @@ -356,7 +356,7 @@ "\n", "\n", "def make_discriminator_model():\n", - " \"\"\"Constrcut discriminator model.\"\"\"\n", + " \"\"\"Construct discriminator model.\"\"\"\n", " model = tf.keras.Sequential()\n", " model.add(layers.Dense(256, use_bias=False, input_shape=(N_QUBITS,)))\n", " model.add(layers.Dense(128, activation='relu'))\n", @@ -538,7 +538,7 @@ "id": "4ceb5dc64798" }, "source": [ - "## 3. Vizualize training and performance\n", + "## 3. Visualize training and performance\n", "\n", "The TensorBoard dashboard can now be launched with:" ] @@ -901,7 +901,7 @@ "id": "0ab7afeef60f" }, "source": [ - "When calling `train` the TensoBoard dashboard will auto-update with all of the summary statistics given in the training loop." + "When calling `train` the TensorBoard dashboard will auto-update with all of the summary statistics given in the training loop." ] }, { From 48a461ed6bd8730ed3468ad609bd45511283d19f Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Wed, 3 Sep 2025 16:23:58 +0530 Subject: [PATCH 3/3] Fix typos in research_tools.ipynb --- tensorflow_quantum/python/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_quantum/python/util.py b/tensorflow_quantum/python/util.py index dab705082..006dce8bd 100644 --- a/tensorflow_quantum/python/util.py +++ b/tensorflow_quantum/python/util.py @@ -113,7 +113,7 @@ def _apply_random_control(gate, all_qubits): if n_open == 0: # No open qubits to control. Return unmodified gate. return gate - control_locs = random.sample(list(open_qubits), n_open) + control_locs = random.sample(open_qubits, n_open) control_values = random.choices([0, 1], k=n_open) # TODO(tonybruguier,#636): Here we call the parent's class controlled_by # because Cirq's breaking change #4167 created 3-qubit gates that cannot be