@@ -222,7 +222,7 @@ unseed!(x::AbstractArray, i) = unseed!(x[i])
222222# `forward_pass!`/`reverse_pass!`.
223223capture (t:: TrackedReal ) = ifelse (hastape (t), t, value (t))
224224capture (t:: TrackedArray ) = t
225- capture (t:: AbstractArray ) = istracked (t) ? map (capture, t) : copy (t)
225+ capture (t:: AbstractArray ) = istracked (t) ? map! (capture, similar (t) , t) : copy (t)
226226
227227# #######################
228228# Conversion/Promotion #
@@ -415,7 +415,6 @@ Base.float(t::TrackedReal{V}) where {V<:AbstractFloat} = t
415415
416416Base. one (:: Type{TrackedReal{V,D,O}} ) where {V,D,O} = TrackedReal {V,D,O} (one (V))
417417Base. zero (:: Type{TrackedReal{V,D,O}} ) where {V,D,O} = TrackedReal {V,D,O} (zero (V))
418- Base. zero (:: Type{<:TrackedReal{V,D}} ) where {V,D} = TrackedReal {V,D,Nothing} (zero (V))
419418
420419Base. rand (:: Type{TrackedReal{V,D,O}} ) where {V,D,O} = TrackedReal {V,D,O} (rand (V))
421420Base. rand (rng:: Random.AbstractRNG , :: Type{TrackedReal{V,D,O}} ) where {V,D,O} = TrackedReal {V,D,O} (rand (rng, V))
0 commit comments