-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable pickling and copying #1
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1 +/- ##
==========================================
+ Coverage 62.09% 62.73% +0.65%
==========================================
Files 8 8
Lines 910 931 +21
==========================================
+ Hits 565 584 +19
- Misses 345 347 +2
|
.def("__repr__", &lexical_cast<string, Params>); | ||
.def("__repr__", &lexical_cast<string, Params>) | ||
.def("__copy__", [](const Params &s){ | ||
return Params(s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Params
contains smart pointers... are we sure that this is the correct way to do this? In the sense that this will be not be an "honest" deep copy, as e.g. prob_i
and prob_r
will still point to the old python object I think...
return Params(s); | ||
}) | ||
.def("__deepcopy__", [](const Params &s, py::dict){ | ||
return Params(s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Enables pickling of
sib.Test
, and copying ofsib.Params
andsib.FactorGraph
. This is needed in some cases when the rankers need to be copied in-memory.Also, align the code in some places, and add some comments.