Skip to content
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

Remove numpy<1.24 restriction from requirements.txt #6149

Merged
merged 4 commits into from Jun 22, 2023

Conversation

tanujkhattar
Copy link
Collaborator

Fixes #5967

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor

@maffoo maffoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to update, but do we want to change proper_repr so that it produces valid reprs with the new numpy version?

"input_states = [(a, b, 0) for a, b in itertools.product([0, 1], repeat=2)]\n",
"output_states = [(a, b, a & b) for a, b, _ in input_states]\n",
"\n",
"\n",
"for inp, out in zip(input_states, output_states):\n",
" result = cirq.Simulator().simulate(c2, initial_state=inp)\n",
" result = cirq.Simulator(dtype=np.complex128).simulate(c2, initial_state=inp)\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thet test started failing for Windows because of precision issues. I didn't dig very deep on whether it's something related to the new release or whether the test was flaky in the first place (probably more likely) so I just increased the precision and it seems to work fine.

The relevant statements in the cell below, that depend on the precision, are:

    "inds, = np.where(abs(result.final_state_vector) > 1e-8)\n",
    "assert len(inds) == 1\n",

@tanujkhattar
Copy link
Collaborator Author

@maffoo proper_repr was updated as part of #5991 to produce valid reprs for numpy 1.24

@CirqBot CirqBot added the Size: XS <10 lines changed label Jun 22, 2023
@tanujkhattar tanujkhattar enabled auto-merge (squash) June 22, 2023 21:08
@tanujkhattar tanujkhattar merged commit 6c251a3 into quantumlib:master Jun 22, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: XS <10 lines changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Numpy 1.24 breaks master.
4 participants