490490end
491491
492492@testset " accumulate" begin
493- testf (f, x) = Array (f (MtlArray (x))) ≈ f (x)
494493 for n in (0 , 1 , 2 , 3 , 10 , 10_000 , 16384 , 16384 + 1 ) # small, large, odd & even, pow2 and not
495494 @test testf (x-> accumulate (+ , x), rand (Float32, n))
496495 @test testf (x-> accumulate (+ , x), rand (Float32, n, 2 ))
@@ -500,17 +499,17 @@ end
500499 # multidimensional
501500 for (sizes, dims) in ((2 ,) => 2 ,
502501 (3 ,4 ,5 ) => 2 ,
503- (1 , 70 , 50 , 20 ) => 3 )
504- @test testf (x-> accumulate (+ , x; dims= dims), rand (Int , sizes))
505- @test testf (x-> accumulate (+ , x), rand (Int , sizes))
502+ (1 , 70 , 50 , 20 ) => 3 , )
503+ @test testf (x-> accumulate (+ , x; dims= dims), rand (- 10 : 10 , sizes))
504+ @test testf (x-> accumulate (+ , x), rand (- 10 : 10 , sizes))
506505 end
507506
508507 # using initializer
509508 for (sizes, dims) in ((2 ,) => 2 ,
510509 (3 ,4 ,5 ) => 2 ,
511510 (1 , 70 , 50 , 20 ) => 3 )
512- @test testf (Base. Fix2 ((x,y)-> accumulate (+ , x; dims= dims, init= y), rand (Int )), rand (Int , sizes))
513- @test testf (Base. Fix2 ((x,y)-> accumulate (+ , x; init= y), rand (Int )), rand (Int , sizes))
511+ @test testf (Base. Fix2 ((x,y)-> accumulate (+ , x; dims= dims, init= y), rand (- 10 : 10 )), rand (- 10 : 10 , sizes))
512+ @test testf (Base. Fix2 ((x,y)-> accumulate (+ , x; init= y), rand (- 10 : 10 )), rand (- 10 : 10 , sizes))
514513 end
515514
516515 # in place
0 commit comments