Skip to content

Commit

Permalink
only instantiate TapedFunction if not in tf.subtapes
Browse files Browse the repository at this point in the history
Co-authored-by: David Widmann <[email protected]>
  • Loading branch information
markus7800 and devmotion authored Feb 2, 2024
1 parent 2ef618a commit 8aec918
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tapedfunction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ function (instr::Instruction{F})(tf::TapedFunction, callback=nothing) where F
output = if is_primitive(func, inputs...)
func(inputs...)
else
tf_inner = get!(tf.subtapes, instr, TapedFunction(func, inputs..., cache=true))
tf_inner = get!(tf.subtapes, instr) do
TapedFunction(func, inputs...; cache=true)
end
# continuation=false breaks "Multiple func calls subtapes" and "Copying task with subtapes"
tf_inner(inputs...; callback=callback, continuation=true)
end
Expand Down

0 comments on commit 8aec918

Please sign in to comment.