Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
pxl-th committed Jan 18, 2025
1 parent 8baa2b2 commit e68a4ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/chainrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,12 @@ end
end

@testset "No thunks in the gradient" begin
struct Dense
struct CustomDense
w::Matrix{Float32}
end
(d::Dense)(x) = d.w * x
(d::CustomDense)(x) = d.w * x

layers = [Dense(rand(Float32, 3, 3))]
layers = [CustomDense(rand(Float32, 3, 3))]
x = ones(Float32, 3)
g = gradient(layers -> sum(layers[1](x)), layers)[1]
@test g[1] isa NamedTuple
Expand Down

0 comments on commit e68a4ad

Please sign in to comment.