Skip to content

Commit 15f5dda

Browse files
KDr2yebai
andauthored
tape_copy Core.Box (#116)
* tape_copy Core.Box * Update Project.toml Co-authored-by: Hong Ge <[email protected]>
1 parent ab7cde4 commit 15f5dda

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f"
33
license = "MIT"
44
desc = "Tape based task copying in Turing"
55
repo = "https://github.com/TuringLang/Libtask.jl.git"
6-
version = "0.6.6"
6+
version = "0.6.7"
77

88
[deps]
99
IRTools = "7869d1d1-7146-5819-86e3-90919afe41df"

Diff for: src/tapedfunction.jl

+3
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ deeply copied, one can add a method to this function.
291291
"""
292292
function tape_copy end
293293
tape_copy(x) = x
294+
# Core.Box is used as closure captured variable container, so we should tape_copy its contents
295+
tape_copy(x::Core.Box) = Core.Box(tape_copy(x.contents))
296+
# ?? should we deepcopy Array and Dict by default?
294297
# tape_copy(x::Array) = deepcopy(x)
295298
# tape_copy(x::Dict) = deepcopy(x)
296299

0 commit comments

Comments
 (0)