Skip to content

Commit 1e5dfdd

Browse files
Deepcopy model in LibtaskModel (#92)
* Move things around * Add test, fix comments * Copy * Update Project.toml --------- Co-authored-by: Hong Ge <[email protected]>
1 parent 955a562 commit 1e5dfdd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AdvancedPS"
22
uuid = "576499cb-2369-40b2-a588-c64705576edc"
33
authors = ["TuringLang"]
4-
version = "0.5.3"
4+
version = "0.5.4"
55

66
[deps]
77
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

ext/AdvancedPSLibtaskExt.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ function AdvancedPS.LibtaskModel(
3232
)
3333
end
3434

35+
"""
36+
copy(model::AdvancedPS.LibtaskModel)
37+
38+
The task is copied (forked) and the inner model is deepcopied.
39+
"""
3540
function Base.copy(model::AdvancedPS.LibtaskModel)
36-
return AdvancedPS.LibtaskModel(model.f, copy(model.ctask))
41+
return AdvancedPS.LibtaskModel(deepcopy(model.f), copy(model.ctask))
3742
end
3843

3944
const LibtaskTrace{R} = AdvancedPS.Trace{<:AdvancedPS.LibtaskModel,R}

0 commit comments

Comments
 (0)