Skip to content

Commit

Permalink
Add rule for push!(::IdSet)
Browse files Browse the repository at this point in the history
This is required on 1.11 because the underlying implementation has changed.
  • Loading branch information
ToucheSir authored Jan 8, 2024
1 parent 9df7226 commit 4638239
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ end
end
end

# IdSet (needed for nested AD with implicit params)
function _pullback(cx::AContext, ::typeof(push!), s::IdSet, @nospecialize(x))
res = push!(s, x)
function idset_push!_pullback(_)
Δ = pop!(grad_mut(cx, d), x, nothing)
(nothing, Δ, nothing)
end
return res, idset_push!_pullback
end

# Dictionaries

grad_mut(d::AbstractDict) = Dict()
Expand Down

0 comments on commit 4638239

Please sign in to comment.