Skip to content

Commit 4d1bb3e

Browse files
committed
combine ChainRulesCore.rrule for symbol and Val
1 parent 9fae2df commit 4d1bb3e

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/if_required/chainrulescore.jl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
function ChainRulesCore.rrule(::typeof(getproperty), x::ComponentArray, ::Val{s}) where {s}
2-
function getproperty_adjoint(Δ)
3-
zero_x = zero(x)
4-
setproperty!(zero_x, s, Δ)
5-
return (ChainRulesCore.NoTangent(), zero_x, ChainRulesCore.NoTangent())
6-
end
7-
8-
return getproperty(x, s), getproperty_adjoint
9-
end
10-
11-
function ChainRulesCore.rrule(::typeof(getproperty), x::ComponentArray, s::Symbol)
1+
function ChainRulesCore.rrule(::typeof(getproperty), x::ComponentArray, s::Union{Symbol, Val})
122
function getproperty_adjoint(Δ)
133
zero_x = zero(x)
144
setproperty!(zero_x, s, Δ)

0 commit comments

Comments
 (0)