Skip to content

Commit 4097259

Browse files
committed
fix StackOverFlow for Hessians
1 parent b050c39 commit 4097259

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/derivatives/broadcast.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ Broadcast.BroadcastStyle(::TrackedStyle, b::BroadcastStyle) = TrackedStyle()
3939

4040
# We have to re-build the original broadcast struct to get the appropriate array
4141
# style. We need this primarily to support CuArrays' broadcasting fixes.
42-
broadcast_rebuild(xs) = value(xs)
42+
broadcast_rebuild(xs) = recur_value(xs)
43+
recur_value(xs) = xs
44+
recur_value(xs::Union{TrackedReal, TrackedArray}) = recur_value(value(xs))
45+
4346
function broadcast_rebuild(bc::Broadcasted)
4447
broadcasted(bc.f, broadcast_rebuild.(bc.args)...)
4548
end

0 commit comments

Comments
 (0)