Skip to content

Commit

Permalink
change Ops.reduce test case to reflect stablehlo semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
tharittk authored and avik-pal committed Mar 5, 2025
1 parent dc16700 commit b7ec728
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/ops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1079,17 +1079,19 @@ end
return dropdims(r,dims=tuple(findall(size(r).==1)...))
end

A = rand(3, 4, 5)
# Floating point operation is not associative
A = rand(Int64, 3, 4, 5)
A_ra = Reactant.to_rarray(A)
init = 2.1
init = 1
init_ra = @jit Reactant.Ops.constant(init)

dims = [2]
r_hlo = @jit Reactant.Ops.reduce(A_ra, init_ra, dims, *)
r = reduce(*, A; dims=dims, init=init)
@test r_hlo squeeze_dims(r)

dims = [1,3]
init = 0
init_ra = @jit Reactant.Ops.constant(init)
r_hlo = @jit Reactant.Ops.reduce(A_ra, init_ra, dims, +)
r = reduce(+, A; dims=dims, init=init)
@test r_hlo squeeze_dims(r)
Expand All @@ -1101,5 +1103,3 @@ end

end



0 comments on commit b7ec728

Please sign in to comment.