-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimizer failure #6764
Comments
A As for the circuit in question: import cirq as c
qubits = c.LineQubit.range(4)
circuit = c.Circuit()
circuit.append(c.rz(-0.0171*np.pi)(qubits[0]))
circuit.append(c.CNOT(qubits[3], qubits[1]))
circuit.append(c.MSGate(rads=-0.01*np.pi)(qubits[0], qubits[1]))
circuit.append(c.Y(qubits[0]))
circuit.append(c.CSWAP(qubits[2], qubits[0], qubits[3]))
circuit.append(c.Ry(rads=0.014*np.pi)(qubits[2]))
circuit.append(c.Z(qubits[3]))
circuit.append(c.ISWAP(qubits[0], qubits[2]))
circuit.append(c.XX(qubits[1], qubits[3]))
circuit.append(c.XXPowGate(exponent=0.26, global_shift=100000%2)(qubits[2], qubits[3]))
circuit.append(c.ISWAP(qubits[0], qubits[2]))
circuit.append(c.Ry(rads=-0.042*np.pi)(qubits[3]))
# print(circuit)
optimized = c.optimize_for_target_gateset(circuit, gateset = cg.SycamoreTargetGateset())
print(optimized)
And even with a non zero
|
Even though the value is not practical the gate did accept the value and it failed later at the optimization stage. A human error with such value is still possible and its effects are realized later. Printing the circuit does not show that value so debugging the source of issue could be hard for a developer. |
Discussed during bit.ly/cirq-cynq today (2024-10-16): it should do either numeric validation, or or adjust the shift. (Note that the global shift could be symbolic.) |
Description of the issue
The
optimize_for_target_gateset
crashes when trying to optimize XXPowGate with larger global shift value. The optimizer crashes with division by zero error.How to reproduce the issue
Cirq version: 1.4.1
The text was updated successfully, but these errors were encountered: