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: listarray - slicing expects scalars #2069

Merged
merged 5 commits into from
Jan 9, 2023

Conversation

ianna
Copy link
Collaborator

@ianna ianna commented Jan 5, 2023

fixes issue #2068

@ianna ianna linked an issue Jan 5, 2023 that may be closed by this pull request
2 tasks
@ianna ianna marked this pull request as draft January 5, 2023 17:32
@codecov
Copy link

codecov bot commented Jan 5, 2023

Codecov Report

Merging #2069 (6dbf0a7) into main (7d38ba1) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files
Impacted Files Coverage Δ
src/awkward/contents/listarray.py 90.08% <100.00%> (ø)

@pre-commit-ci pre-commit-ci bot temporarily deployed to docs-preview January 5, 2023 17:46 Inactive
@ianna ianna temporarily deployed to docs-preview January 6, 2023 14:01 — with GitHub Actions Inactive
@ianna ianna marked this pull request as ready for review January 7, 2023 22:36
@ianna ianna requested a review from agoose77 January 7, 2023 22:36
@ianna
Copy link
Collaborator Author

ianna commented Jan 7, 2023

@agoose77 - I haven't checked if you might have fixed it already?

@ianna ianna temporarily deployed to docs-preview January 7, 2023 22:43 — with GitHub Actions Inactive
@agoose77
Copy link
Collaborator

agoose77 commented Jan 8, 2023

Nope, I haven't touched this yet!

Copy link
Collaborator

@agoose77 agoose77 left a comment

Choose a reason for hiding this comment

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

Ah I see, so this bug occurs because CuPy returns 0-D arrays instead of scalars. This is annoying! I think your fix looks like the best option available; we want to convert these to primitive types as soon as possible.

One request: could we change x.item() for int(x)? It would be one-less thing that typetracer needs to implement (even though this is a known_data branch).

@ianna ianna force-pushed the ianna/2068-cuda-aknum-tests-fail branch from 555deda to bdf29e1 Compare January 8, 2023 16:04
@ianna ianna requested a review from agoose77 January 8, 2023 16:07
@ianna
Copy link
Collaborator Author

ianna commented Jan 8, 2023

Ah I see, so this bug occurs because CuPy returns 0-D arrays instead of scalars. This is annoying! I think your fix looks like the best option available; we want to convert these to primitive types as soon as possible.

One request: could we change x.item() for int(x)? It would be one-less thing that typetracer needs to implement (even though this is a known_data branch).

done

@ianna ianna temporarily deployed to docs-preview January 8, 2023 16:12 — with GitHub Actions Inactive
@ianna ianna changed the title fix: try to fix cuda tests fix: listarray - slicing expects scalars Jan 8, 2023
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

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

Just changing int to item.

src/awkward/contents/listarray.py Outdated Show resolved Hide resolved
src/awkward/contents/listarray.py Outdated Show resolved Hide resolved
@jpivarski
Copy link
Member

One request: could we change x.item() for int(x)?

Oops—I just noticed that. I thought your opinion was the other way around. Is it because you'll be swapping method calls for function calls (although int isn't an nplike function)?

As I said, I only have a slight preference for item; it's because int looks like a mistake and I'd have to remind myself of this issue with CuPy to know why it's there. I was assuming that this method call (item) would be replaced by an nplike function (either item or a name that array libraries are unlikely to take in the future).

@jpivarski jpivarski temporarily deployed to docs-preview January 9, 2023 16:47 — with GitHub Actions Inactive
@ianna ianna temporarily deployed to docs-preview January 9, 2023 17:00 — with GitHub Actions Inactive
@agoose77
Copy link
Collaborator

agoose77 commented Jan 9, 2023

I made the case to @ianna to change this, but it was only a mild preference. Given that we both have mild preferences, let's just accept this as-is!

@agoose77
Copy link
Collaborator

agoose77 commented Jan 9, 2023

(@ianna feel free to merge!)

@jpivarski jpivarski merged commit c1df632 into main Jan 9, 2023
@jpivarski jpivarski deleted the ianna/2068-cuda-aknum-tests-fail branch January 9, 2023 18:24
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.

cuda ak.num tests fail
3 participants