Skip to content

Commit e9cf749

Browse files
chore: add unthunk_tangent rule for Ref (#1564)
1 parent 042560f commit e9cf749

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/compiler/chainrules.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@inline ZygoteRules.unthunk_tangent(x::NTuple{N,<:Number}) where N = x
55
@inline ZygoteRules.unthunk_tangent(x::AbstractArray{<:Number,N}) where N = x
66
@inline ZygoteRules.unthunk_tangent(x::AbstractArray) = map(unthunk_tangent, x)
7+
@inline ZygoteRules.unthunk_tangent(r::Base.RefValue) = r[] = unthunk_tangent(r[])
78
ZygoteRules.unthunk_tangent(d::IdDict) = IdDict([unthunk_tangent(k) => unthunk_tangent(v) for (k, v) in d])
89
@non_differentiable unthunk_tangent(::IdDict)
910

0 commit comments

Comments
 (0)