File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ function Base.findall(bools::AnyCuArray{Bool})
27
27
I = keytype (bools)
28
28
indices = cumsum (reshape (bools, prod (size (bools))))
29
29
30
- n = @allowscalar indices[end ]
30
+ n = isempty (indices) ? 0 : @allowscalar indices[end ]
31
31
ys = CuArray {I} (undef, n)
32
32
33
33
if n > 0
Original file line number Diff line number Diff line change @@ -478,10 +478,14 @@ end
478
478
479
479
@testset " findall" begin
480
480
# 1D
481
+ @test testf (x-> findall (x), rand (Bool, 0 ))
481
482
@test testf (x-> findall (x), rand (Bool, 100 ))
482
483
@test testf (x-> findall (y-> y> 0.5 , x), rand (100 ))
483
484
484
485
# ND
486
+ let x = rand (Bool, 0 , 0 )
487
+ @test findall (x) == Array (findall (CuArray (x)))
488
+ end
485
489
let x = rand (Bool, 10 , 10 )
486
490
@test findall (x) == Array (findall (CuArray (x)))
487
491
end
You can’t perform that action at this time.
0 commit comments