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

Fix warning on array creation from ragged sequences #4801

Merged
merged 2 commits into from
Jan 5, 2022

Conversation

pavoljuhas
Copy link
Collaborator

Avoid conversion of ragged nested sequences to numpy array.
Use simple equality check to compare lists of tuples.
Use RandomState.choice to get item index instead of the item itself
which implies conversion to numpy.array.

Fixes check/pytest -Werror:'Creating an ndarray from ragged'

Avoid conversion of ragged nested sequences to numpy array.
Use simple equality check to compare list of tuples.
Use RandomState.choice to get item index instead of item itself
(which implies conversion to numpy.array).
@pavoljuhas pavoljuhas requested review from cduck, vtomole and a team as code owners January 5, 2022 20:20
@CirqBot CirqBot added the Size: XS <10 lines changed label Jan 5, 2022
@pavoljuhas pavoljuhas requested a review from mpharrigan January 5, 2022 20:20
@MichaelBroughton MichaelBroughton self-assigned this Jan 5, 2022
Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

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

LGTM

@MichaelBroughton MichaelBroughton added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jan 5, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jan 5, 2022
@CirqBot CirqBot merged commit 3d90501 into quantumlib:master Jan 5, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jan 5, 2022
@pavoljuhas pavoljuhas deleted the fix-ragged-nested-arrays branch January 6, 2022 00:49
MichaelBroughton pushed a commit to MichaelBroughton/Cirq that referenced this pull request Jan 22, 2022
Avoid conversion of ragged nested sequences to numpy array.
Use simple equality check to compare lists of tuples.
Use RandomState.choice to get item index instead of the item itself
which implies conversion to numpy.array.

Fixes  check/pytest -Werror:'Creating an ndarray from ragged'
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Avoid conversion of ragged nested sequences to numpy array.
Use simple equality check to compare lists of tuples.
Use RandomState.choice to get item index instead of the item itself
which implies conversion to numpy.array.

Fixes  check/pytest -Werror:'Creating an ndarray from ragged'
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
Avoid conversion of ragged nested sequences to numpy array.
Use simple equality check to compare lists of tuples.
Use RandomState.choice to get item index instead of the item itself
which implies conversion to numpy.array.

Fixes  check/pytest -Werror:'Creating an ndarray from ragged'
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.

3 participants