Skip to content

Commit fe8e91f

Browse files
committed
Test coverage for restructuring in gradient
1 parent 0860fe4 commit fe8e91f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/utils.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,15 @@ end
378378
p, re = destructure(m)
379379
testdense(re(p), bt)
380380
end
381+
382+
@testset "restructure in gradient" begin
383+
x = rand(Float32, 3, 1)
384+
m = dm(zeros)
385+
∇m = gradient(m -> sum(m(x)), m)[1]
386+
p, re = destructure(m)
387+
∇p = gradient-> sum(re(θ)(x)), p)[1]
388+
@test ∇p destructure(∇m)[1]
389+
end
381390
end
382391
end
383392

0 commit comments

Comments
 (0)