|
413 | 413 | @test view(b, :, 1, :) isa StridedCuArray |
414 | 414 | end |
415 | 415 |
|
416 | | -@testset "accumulate" begin |
417 | | - for n in (0, 1, 2, 3, 10, 10_000, 16384, 16384+1) # small, large, odd & even, pow2 and not |
418 | | - @test testf(x->accumulate(+, x), rand(n)) |
419 | | - @test testf(x->accumulate(+, x), rand(n,2)) |
420 | | - @test testf((x,y)->accumulate(+, x; init=y), rand(n), rand()) |
421 | | - end |
422 | | - |
423 | | - # multidimensional |
424 | | - for (sizes, dims) in ((2,) => 2, |
425 | | - (3,4,5) => 2, |
426 | | - (1, 70, 50, 20) => 3) |
427 | | - @test testf(x->accumulate(+, x; dims=dims), rand(Int, sizes)) |
428 | | - @test testf(x->accumulate(+, x), rand(Int, sizes)) |
429 | | - end |
430 | | - |
431 | | - # using initializer |
432 | | - for (sizes, dims) in ((2,) => 2, |
433 | | - (3,4,5) => 2, |
434 | | - (1, 70, 50, 20) => 3) |
435 | | - @test testf((x,y)->accumulate(+, x; dims=dims, init=y), rand(Int, sizes), rand(Int)) |
436 | | - @test testf((x,y)->accumulate(+, x; init=y), rand(Int, sizes), rand(Int)) |
437 | | - end |
438 | | - |
439 | | - # in place |
440 | | - @test testf(x->(accumulate!(+, x, copy(x)); x), rand(2)) |
441 | | - |
442 | | - # specialized |
443 | | - @test testf(cumsum, rand(2)) |
444 | | - @test testf(cumprod, rand(2)) |
445 | | - |
446 | | - @test_throws ArgumentError("accumulate does not support the keyword arguments [:bad_kwarg]") accumulate(+, CUDA.rand(1024); bad_kwarg="bad") |
447 | | -end |
448 | | - |
449 | 416 | @testset "logical indexing" begin |
450 | 417 | @test CuArray{Int}(undef, 2)[CUDA.ones(Bool, 2)] isa CuArray |
451 | 418 | @test CuArray{Int}(undef, 2, 2)[CUDA.ones(Bool, 2, 2)] isa CuArray |
|
0 commit comments