Skip to content

Commit 672698d

Browse files
committed
Add test
1 parent 6e23e61 commit 672698d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/rulesets/Base/indexing.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,17 @@ end
261261
Val(3);
262262
check_inferred=(VERSION >= v"1.7"),
263263
)
264+
265+
# eachslice: Make sure pulling back an array of thunks unthunks them and does not return all zeros.
266+
x = ones(Float32, 3)
267+
Δ = ones(Float32, 1)
268+
_, norm_back = ChainRules.rrule(norm, x)
269+
dx = norm_back(Δ)[2]
270+
@test dx isa AbstractThunk
271+
272+
x = ones(Float32, 3, 1)
273+
_, eachcol_back = ChainRules.rrule(eachcol, x)
274+
Δ2 = [dx]
275+
dx2 = eachcol_back(Δ2)[2]
276+
@test all(dx2 .≉ 0f0)
264277
end

0 commit comments

Comments
 (0)