@@ -206,44 +206,6 @@ function ChainRulesCore.rrule(::typeof(rotr90), a::AbstractMatrix)
206206 return rotr90 (a), rotr90_pullback
207207end
208208
209- # Differentiable setindex! alternative
210- function _setindex (a:: AbstractArray , v, args... )
211- b:: typeof (a) = copy (a)
212- b[args... ] = v
213- return b
214- end
215-
216- function ChainRulesCore. rrule (:: typeof (_setindex), a:: AbstractArray , tv, args... )
217- t = _setindex (a, tv, args... )
218-
219- function _setindex_pullback (v)
220- if iszero (v)
221- backwards_tv = ZeroTangent ()
222- backwards_a = ZeroTangent ()
223- else
224- v = if v isa Tangent
225- ChainRulesCore. construct (typeof (a), ChainRulesCore. backing (v))
226- else
227- v
228- end
229- # TODO : Fix this for ZeroTangents
230- v = typeof (v) != typeof (a) ? convert (typeof (a), v) : v
231- # v = convert(typeof(a),v);
232- backwards_tv = v[args... ]
233- backwards_a = copy (v)
234- if typeof (backwards_tv) == eltype (a)
235- backwards_a[args... ] = zero (v[args... ])
236- else
237- backwards_a[args... ] = zero .(v[args... ])
238- end
239- end
240- return (
241- NoTangent (), backwards_a, backwards_tv, fill (ZeroTangent (), length (args))... ,
242- )
243- end
244- return t, _setindex_pullback
245- end
246-
247209# TODO : link to Zygote.showgrad once they update documenter.jl
248210"""
249211 @showtypeofgrad(x)
0 commit comments