quantumcomputingbook
quantumcomputingbook copied to clipboard
qnn.py update for most recent versions of Cirq (v0.11+)
Hello,
As discussed in issues, here is a pull request with a small update on chapter 9's qnn.py script.
The following changes have been made:
- (add-on compared to opened issue) Removal of
TwoQubitGatefrom the inheritance arguments of classZXGate(lines 10-11) as it will be deprecated with cirq v0.14 onward. This is replaced with overriding the function_num_qubits_in the body of the class such that:
def _num_qubits_(self):
return 2
- Addition of the
recursive:boolargument to the override of the function_resolve_parameters_(line 36) in the body of custom classZXGateso as to work with cirq versions v0.11 and further. - Replacement of
wf = result.final_statewithwf = result.final_state_vector(line 79) in the body of functionreadout_expectation.
Best regards,
Quentin