Description of the issue
Currently cirq_google.GridDevice requires that for any operation with exactly two qubits, the pair of qubits must be in qubit_pairs. However, not all 2-qubit operations require the qubits to be coupled. In particular, MeasurementGate should be allowed on any set of qubits, including pairs that are not coupled.
How to reproduce the issue
In [1]: import cirq; import cirq_google
In [2]: cirq_google.Sycamore.validate_operation(cirq.measure(cirq.q(0, 5), cirq.q(2, 5), cirq.q(4, 5)))
In [3]: cirq_google.Sycamore.validate_operation(cirq.measure(cirq.q(0, 5), cirq.q(2, 5)))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-5-a955df2ee85c> in <module>
----> 1 cirq_google.Sycamore.validate_operation(cirq.measure(cirq.q(0, 5), cirq.q(2, 5)))
~/src/quantumlib/cirq/cirq-google/cirq_google/devices/grid_device.py in validate_operation(self, operation)
341 and frozenset(operation.qubits) not in self._metadata.qubit_pairs
342 ):
--> 343 raise ValueError(f'Qubit pair is not valid on device: {operation.qubits!r}.')
344
345 def __str__(self) -> str:
ValueError: Qubit pair is not valid on device: (cirq.GridQubit(0, 5), cirq.GridQubit(2, 5)).
Cirq version
0.15
Description of the issue
Currently
cirq_google.GridDevicerequires that for any operation with exactly two qubits, the pair of qubits must be inqubit_pairs. However, not all 2-qubit operations require the qubits to be coupled. In particular,MeasurementGateshould be allowed on any set of qubits, including pairs that are not coupled.How to reproduce the issue
Cirq version
0.15