Skip to content
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

add serialization support in tensors #109

Merged
merged 28 commits into from
Jul 23, 2020
Merged

add serialization support in tensors #109

merged 28 commits into from
Jul 23, 2020

Conversation

bcebere
Copy link
Member

@bcebere bcebere commented Jul 22, 2020

Description

Protobuff support for tensors

  • Support in BFVVector and CKKSVector
  • Python bindings
  • gtest
  • pytest

fixes #72

Checklist

@youben11 youben11 added the Type: New Feature ➕ Introduction of a completely new addition to the codebase label Jul 22, 2020
@bcebere bcebere changed the title [WIP] add serialization support in tensors add serialization support in tensors Jul 22, 2020
@bcebere bcebere requested review from youben11 and philomath213 and removed request for youben11 July 22, 2020 12:40
Copy link
Member

@youben11 youben11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying this locally and it's really exciting! Can't wait to try a client/server scenario!

tenseal/tensealcontext.cpp Outdated Show resolved Hide resolved
@@ -1,12 +1,40 @@
import tenseal as ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice spot for the filename lol

tests/tensors/test_bfv_vector.py Outdated Show resolved Hide resolved
tenseal/proto/tensors.proto Outdated Show resolved Hide resolved
@bcebere bcebere requested a review from youben11 July 23, 2020 08:57
tenseal/tensors/__init__.py Outdated Show resolved Hide resolved
tenseal/tensors/ckksvector.cpp Outdated Show resolved Hide resolved
tenseal/tensors/ckksvector.cpp Outdated Show resolved Hide resolved
tenseal/tensealcontext.cpp Outdated Show resolved Hide resolved
@philomath213
Copy link
Member

This is really great work, it will allow us to build and try client/server scenarios easily.
I just left few comments.
Good job @bcebere.

Copy link
Member

@youben11 youben11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is looking amazing!

I just left a quick remark about the Python API for creating tensors, and I'm also wondering about pickling: I see that it's still serializing the context, right? I don't won't to bother you with that on this PR but I think we can track a new issue about optimizing this that can be summarized in the following points:

  • When pickling, serialize the vector only
  • When unpickling, deserialize the vector only, setting its context to nullptr
  • Add a method for linking vectors with a context
  • Vectors shouldn't be operational while not linked to a context
  • The vector shouldn't be operational after unpickling until it has been linked to a context

tenseal/tensors/__init__.py Outdated Show resolved Hide resolved
Copy link
Member

@youben11 youben11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done Bogdan! Just wrapped raised errors in a TypeError

tenseal/tensors/__init__.py Outdated Show resolved Hide resolved
tenseal/tensors/__init__.py Outdated Show resolved Hide resolved
tenseal/tensors/__init__.py Outdated Show resolved Hide resolved
tenseal/tensors/__init__.py Outdated Show resolved Hide resolved
tenseal/tensors/__init__.py Outdated Show resolved Hide resolved
bcebere and others added 7 commits July 23, 2020 21:44
Co-authored-by: Ayoub Benaissa <ayouben9@gmail.com>
Co-authored-by: Ayoub Benaissa <ayouben9@gmail.com>
Co-authored-by: Ayoub Benaissa <ayouben9@gmail.com>
Co-authored-by: Ayoub Benaissa <ayouben9@gmail.com>
Co-authored-by: Ayoub Benaissa <ayouben9@gmail.com>
@bcebere bcebere merged commit 8c3c4e7 into master Jul 23, 2020
@delete-merged-branch delete-merged-branch bot deleted the tensor_serialization branch July 23, 2020 19:20
pierreeliseeflory pushed a commit to pierreeliseeflory/TenSEAL that referenced this pull request Apr 27, 2022
* add serialization support in tensors

* add python support

* add gtests

* tensor serialization tests

* Update tenseal/tensors/__init__.py
Co-authored-by: Ayoub Benaissa <ayouben9@gmail.com>
Co-authored-by: Bilal Retiat <bilalphilomath@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature ➕ Introduction of a completely new addition to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serialise, deserialise; for pickle, deepcopy
3 participants