-
Notifications
You must be signed in to change notification settings - Fork 175
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
Copying Nengo objects #977
Comments
Also, related to #941. |
I started implementing this and it seems to be possible in a quite general manner. The added Probably we don't want to add the object always to a network (otherwise unpickling outside of a network would not be possible because it would raise an exception). |
Yeah, I would say don't add it when unpickling. Maybe we shouldn't allow |
I'm using |
What about something like this? |
Isn't this using a private method in the |
Yep! Probably a bit strange, but I basically just took out the parts of their code that do copying if there's no |
To me it seems to be slightly more effort to disable Python's |
Yeah, I just don't want people to be confused or surprised by it not getting added to the model. I feel like on the user side, we want the default behaviour to be to add it to the network, since I think that's what users will expect. It seems strange if our |
I finished the PR. Using Python's |
Copying of Nengo objects is implemented now. |
From today's meeting, it would be nice to be able to copy Nengo object's cleanly. I think in general we want shallow copies (i.e., don't deepcopy the parameter values); deepcopies aren't necessary since everything we do to make sure we can make multiple simulators also means we don't need to do deepcopies.
Todo:
__getstate__
__setstate__
(see pickle-config branch; ensure we don't duplicate code withFrozenObject
which does some copy stuff).copy
methodadd_to_network
arg on the copy method that adds or doesn't add to currentNetwork.context
copy
moduleThe text was updated successfully, but these errors were encountered: