From aba2eaa621f5fc3eb31369fccb0789d60b986d60 Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Wed, 3 Sep 2025 14:43:29 +0530 Subject: [PATCH] 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