-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Lazy context #197
Lazy context #197
Conversation
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.
Nice and clean! I'm now wondering what happens when we run an operation which requires the tenseal_context? A way to deal with this is to always fetch the tenseal_context using the get method tenseal_context()
, which will handle the case when the tensor is still lazy loaded, throwing an error message to the user. What do you think?
There was another attempt in the PR, but I reverted, you can see here that I was going for a "call guardian" at first b2533dc. Yeah, I will check to use tenseal_context everywhere, it is easier. |
I think as far as it's clear that the tenseal context is a private attribute and shouldn't be used directly (we can mention that in the documentation => this makes me remember that I really need to start documenting my code :p ) we should be good with throwing an error on the getter. |
We can make the tenseal contexr |
Yeah, this would work perfectly I guess |
Actually, we already use tenseal_context in the derived classes, but we need to access _context for the lazy loading, instead of throwing an exception. So, there isn't much too do other than adding a guardian for all calls, to do sanity checks. But I think that is a bit overkill. |
Yeah, I also agree that we shouldn't go for the guardian thing. If there isn't any way to allow only the lazy loader to access that |
updated |
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.
Even better this way! LGTM!
* add lazy loading * python bindings for lazy loading * update tests * make context private
Description
This PR introduces the capability of loading a protobuffer without having the context linked yet.
fixes #193
Checklist