From 45f00a5168ac64ce2eb147c0ae853095e071cc63 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Sun, 15 Sep 2024 23:34:27 -0400 Subject: [PATCH] Add promotion rules (belong in ChainRulesCore) --- src/rulesets/Base/indexing.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rulesets/Base/indexing.jl b/src/rulesets/Base/indexing.jl index 8c5865a98..e2523a8fa 100644 --- a/src/rulesets/Base/indexing.jl +++ b/src/rulesets/Base/indexing.jl @@ -284,6 +284,10 @@ end _zero_fill!(dx::AbstractArray) = fill!(dx, zero(eltype(dx))) +# Belong in ChainRulesCore +Base.promote_type(T::Type{<:Number}, S::Type{<:AbstractZero}) = T +Base.promote_type(T::Type{<:AbstractZero}, S::Type{<:Number}) = S + function rrule(::typeof(∇eachslice), dys, x, vd::Val) function ∇∇eachslice(dz_raw) dz = unthunk(dz_raw)