Skip to content

Commit 178d0b4

Browse files
committed
Got rid of the weird Val thing in the rrule
1 parent 1334c58 commit 178d0b4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/if_required/chainrulescore.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# setproperty!(zero_x, s, Δ)
55
# return getproperty(x, s), zero_x
66
# end
7-
ChainRulesCore.rrule(::typeof(getproperty), x::ComponentArray, s::Symbol) = ChainRulesCore.rrule(getproperty, x, Val(s))
8-
function ChainRulesCore.rrule(::typeof(getproperty), x::ComponentArray, ::Val{s}) where s
7+
ChainRulesCore.rrule(::typeof(getproperty), x::ComponentArray, ::Val{s}) where s = ChainRulesCore.rrule(getproperty, x, s)
8+
function ChainRulesCore.rrule(::typeof(getproperty), x::ComponentArray, s::Symbol)
99
function getproperty_adjoint(Δ)
1010
zero_x = zero(x)
1111
setproperty!(zero_x, s, Δ)
@@ -19,5 +19,4 @@ ChainRulesCore.rrule(::typeof(getdata), x::ComponentArray) = getdata(x), Δ->Com
1919

2020
ChainRulesCore.rrule(::typeof(getaxes), x::ComponentArray) = getaxes(x), Δ->ComponentArray(getdata(x), Δ)
2121

22-
# This won't work because typeof(ComponentArray) is a UnionAll. Do we even need it, though?
2322
ChainRulesCore.rrule(::Type{ComponentArray}, data, axes) = ComponentArray(data, axes), Δ->(getdata(Δ), getaxes(Δ))

0 commit comments

Comments
 (0)