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: uneccessary use of nplike_of #2315

Merged
merged 6 commits into from
Mar 15, 2023
Merged

Conversation

agoose77
Copy link
Collaborator

@agoose77 agoose77 commented Mar 15, 2023

In preparation for a simplification of nplike identification, this PR eliminates redundant nplike_of usages, and/or replaces them with backend_of.

In future, nplike_of will only accept array objects (not layouts, etc).

@agoose77 agoose77 requested a review from jpivarski March 15, 2023 00:04
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.

This is different from the one I've been seeing develop, and it looks pretty simple: making the calls to get nplikes more uniform in preparation for a refactoring. Looks good!

In future, nplike_of will only accept array objects (not layouts, etc).

By "array objects," do you mean buffers, like np.ndarray, cp.ndarray, or TypeTracerArray, not ak.Array? (It seems like that's what you mean.)

@agoose77
Copy link
Collaborator Author

By "array objects," do you mean buffers, like np.ndarray, cp.ndarray, or TypeTracerArray, not ak.Array? (It seems like that's what you mean.)

In an ecosystem with N array types, you'd think I'd be more precise by now ;)

Yes, I mean the nplike buffers. The rewrite of #2307 will simplify nplike_of to simply cache the nplike which returns True for is_own_array_type, and make backend_of do the heavy lifting w.r.t to inspecting layouts, arraybuilder, etc.

@codecov
Copy link

codecov bot commented Mar 15, 2023

Codecov Report

Merging #2315 (4188006) into main (df1eec6) will decrease coverage by 0.02%.
The diff coverage is 95.23%.

Additional details and impacted files
Impacted Files Coverage Δ
src/awkward/behaviors/string.py 76.82% <75.00%> (-0.16%) ⬇️
src/awkward/_broadcasting.py 89.23% <100.00%> (-0.03%) ⬇️
src/awkward/_connect/numpy.py 92.99% <100.00%> (ø)
src/awkward/_errors.py 80.82% <100.00%> (+0.30%) ⬆️
src/awkward/_util.py 75.55% <100.00%> (-0.05%) ⬇️
src/awkward/operations/ak_broadcast_arrays.py 100.00% <100.00%> (ø)
src/awkward/operations/ak_concatenate.py 96.29% <100.00%> (ø)
src/awkward/operations/ak_full_like.py 98.21% <100.00%> (-0.07%) ⬇️
src/awkward/operations/ak_linear_fit.py 89.09% <100.00%> (+1.59%) ⬆️
src/awkward/operations/ak_mask.py 95.45% <100.00%> (-0.20%) ⬇️
... and 1 more

... and 1 file with indirect coverage changes

@agoose77 agoose77 enabled auto-merge (squash) March 15, 2023 00:17
@agoose77 agoose77 temporarily deployed to docs-preview March 15, 2023 00:19 — with GitHub Actions Inactive
@agoose77 agoose77 merged commit 70d6bae into main Mar 15, 2023
@agoose77 agoose77 deleted the agoose77/refactor-use-backend-of branch March 15, 2023 00:36
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.

2 participants