Skip to content

Preserve 0-dim GPU arrays in map #599

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mtfishman
Copy link
Contributor

Preserve 0-dim GPU arrays in map. Fixes #598.

Copy link
Contributor

github-actions bot commented Jun 16, 2025

Your PR no longer requires formatting changes. Thank you for your contribution!

Copy link
Member

@maleadt maleadt left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM, but I'd change the version bump.

Co-authored-by: Tim Besard <tim.besard@gmail.com>
@@ -85,7 +85,7 @@ allequal(x, y, z...) = x == y && allequal(y, z...)
function Base.map(f, xs::AnyGPUArray...)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
function Base.map(f, xs::AnyGPUArray...)
function Base.map(f, x1::AnyGPUArray, xrest::AnyGPUArray...)
xs = (x1, xrest...)

@maleadt on a separate note, wouldn't it be better to define the signature in this way to avoid implicitly overloading Base.map(f), which is type piracy?

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.

map doesn't preserve 0-dim GPU arrays
2 participants