File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 607607
608608# stack
609609function overloaded_stack (dims:: Union{Integer,Colon} , xs)
610- @assert allequal (ndims, xs ) " All arrays must have the same number of dimensions..."
610+ @assert allequal (ndims .(xs) ) " All arrays must have the same number of dimensions..."
611611 dims = dims isa Colon ? ndims (first (xs)) + 1 : dims
612612 res = map (xs) do x
613613 new_shape = ntuple (
Original file line number Diff line number Diff line change 844844 @test @jit (getindex_linear_vector (x_ra, idx_ra)) ≈ getindex_linear_vector (x, idx)
845845 @test @jit (getindex_linear_vector (x_ra, idx)) ≈ getindex_linear_vector (x, idx)
846846end
847+
848+ @testset " stack" begin
849+ x = rand (4 , 4 )
850+ y = rand (4 , 4 )
851+ x_ra = Reactant. to_rarray (x)
852+ y_ra = Reactant. to_rarray (y)
853+
854+ s1 (x) = stack ((x, x))
855+ s2 (x) = stack ((x, x); dims= 2 )
856+ s3 (x, y) = stack ((x, y); dims= 2 )
857+ s4 (x, y) = stack ((x, y, x); dims= 1 )
858+
859+ @test @jit (s1 (x_ra)) ≈ s1 (x)
860+ @test @jit (s2 (x_ra)) ≈ s2 (x)
861+ @test @jit (s3 (x_ra, y_ra)) ≈ s3 (x, y)
862+ @test @jit (s4 (x_ra, y_ra)) ≈ s4 (x, y)
863+
864+ # Test that we don't hit illegal instruction; `x` is intentionally not a traced array
865+ @test @jit (s1 (x)) isa Any
866+ @test @jit (s2 (x)) isa Any
867+ @test @jit (s3 (x, y)) isa Any
868+ @test @jit (s4 (x, y)) isa Any
869+ end
You can’t perform that action at this time.
0 commit comments