Skip to content

qnn.py update for most recent versions of Cirq (v0.11+)#41

Open
qlero wants to merge 2 commits intoJackHidary:masterfrom
qlero:master
Open

qnn.py update for most recent versions of Cirq (v0.11+)#41
qlero wants to merge 2 commits intoJackHidary:masterfrom
qlero:master

Conversation

@qlero
Copy link
Copy Markdown

@qlero qlero commented Mar 19, 2022

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:

  1. (add-on compared to opened issue) Removal of TwoQubitGate from the inheritance arguments of class ZXGate (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
  1. Addition of the recursive:bool argument to the override of the function _resolve_parameters_ (line 36) in the body of custom class ZXGate so as to work with cirq versions v0.11 and further.
  2. Replacement of wf = result.final_state with wf = result.final_state_vector (line 79) in the body of function readout_expectation.

Best regards,

Quentin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant