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

Exit immediately for empty arrays #528

Merged
merged 2 commits into from
Apr 5, 2024
Merged

Conversation

christiangnrd
Copy link
Contributor

Otherwise it fails. See JuliaGPU/Metal.jl#321

@maleadt
Copy link
Member

maleadt commented Apr 5, 2024

When does isempty(A) not imply length(A) == 0? That seems very surprising.

@christiangnrd
Copy link
Contributor Author

When does isempty(A) not imply length(A) == 0? That seems very surprising.

I think they're always equivalent. The functional change of this PR is that it used to return nothing in randn if the input array was empty, and the statement was missing in rand.

Then I replaced length(A) == 0 with isempty(A) for personal preference/slight clarity reasons, but I can change it back to length(A) == 0 if you prefer that.

@maleadt
Copy link
Member

maleadt commented Apr 5, 2024

Then I replaced length(A) == 0 with isempty(A) for personal preference/slight clarity reasons, but I can change it back to length(A) == 0 if you prefer that.

No need, I just missed the actual change because of that :-)

LGTM, thanks!

@maleadt maleadt enabled auto-merge (squash) April 5, 2024 13:19
@maleadt maleadt merged commit d187fd9 into JuliaGPU:master Apr 5, 2024
14 checks passed
@christiangnrd christiangnrd deleted the rand_fixes branch April 5, 2024 14:04
@christiangnrd
Copy link
Contributor Author

Can a new release be tagged?

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