Skip to content

Commit 08cfc36

Browse files
authored
use zero_tangent for _instantiate_zeros
1 parent c69ee3e commit 08cfc36

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/rulesets/Base/array.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ materialises each zero `ẋ` to be `zero(x)`.
7171
"""
7272
_instantiate_zeros(ẋs, xs) = map(_i_zero, ẋs, xs)
7373
_i_zero(ẋ, x) =
74-
_i_zero(ẋ::AbstractZero, x) = zero(x)
75-
# Possibly this won't work for partly non-diff arrays, something like `gradient(x -> ["abc", x][end], 1)`
76-
# may give a MethodError for `zero` but won't be wrong.
74+
_i_zero(ẋ::AbstractZero, x) = zero_tangent(x)
7775

7876
# Fast paths. Should it also collapse all-Zero cases?
7977
_instantiate_zeros(ẋs::Tuple{Vararg{Number}}, xs) = ẋs

0 commit comments

Comments
 (0)