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

Negate operation of FV scheme #3759

Merged
merged 1 commit into from
Jun 25, 2020

Conversation

rav1kantsingh
Copy link
Member

Description

closes #3701
Implemented negation operation of the FV scheme.

Accepts Ciphertext and returns negated value Ciphertext.

Affected Dependencies

None

How has this been tested?

  • Added tests which check the negated values from the operation.

Checklist

@rav1kantsingh rav1kantsingh added Type: New Feature ➕ Introduction of a completely new addition to the codebase Crypto Team labels Jun 21, 2020
@rav1kantsingh rav1kantsingh added this to the BFV Tensor in Python milestone Jun 21, 2020
@rav1kantsingh rav1kantsingh changed the title Add Negate operation of FV scheme Negate operation of FV scheme Jun 21, 2020
@rav1kantsingh rav1kantsingh requested a review from a team June 21, 2020 05:16
@codecov
Copy link

codecov bot commented Jun 21, 2020

Codecov Report

Merging #3759 into master will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3759      +/-   ##
==========================================
- Coverage   94.81%   94.76%   -0.06%     
==========================================
  Files         185      186       +1     
  Lines       18337    18476     +139     
==========================================
+ Hits        17387    17508     +121     
- Misses        950      968      +18     
Impacted Files Coverage Δ
syft/frameworks/torch/he/fv/evaluator.py 97.56% <100.00%> (+0.59%) ⬆️
test/torch/tensors/test_fv.py 100.00% <100.00%> (ø)
...frameworks/torch/tensors/interpreters/gradients.py 94.23% <0.00%> (-5.77%) ⬇️
syft/generic/pointers/pointer_dataset.py 75.00% <0.00%> (-1.09%) ⬇️
...orks/torch/tensors/interpreters/additive_shared.py 93.42% <0.00%> (-0.94%) ⬇️
syft/generic/pointers/pointer_plan.py 75.43% <0.00%> (-0.88%) ⬇️
syft/execution/plan.py 94.65% <0.00%> (-0.05%) ⬇️
test/execution/test_plan.py 100.00% <0.00%> (ø)
syft/execution/computation.py 100.00% <0.00%> (ø)
test/execution/test_translation.py 100.00% <0.00%> (ø)
... and 5 more

for i in range(len(result)):
for j in range(len(result[i])):
for k in range(len(result[i][j])):
result[i][j][k] = negate_mod(ct.data[i][j][k], self.coeff_modulus[j])
Copy link
Member

Choose a reason for hiding this comment

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

Can coeff_modulus[j] get out of bounds?

Copy link
Member Author

Choose a reason for hiding this comment

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

i is iterating on encrypted_size of ciphertext and j is iterating on coeff_modulus used in ciphertext, So till the ciphertext is from same encryption environment (I mean same parameters used) then it should not get out of bound.

Copy link
Member

@bcebere bcebere left a comment

Choose a reason for hiding this comment

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

LGTM!

@youben11 youben11 merged commit 5ad0534 into OpenMined:master Jun 25, 2020
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.

Implement Negation operation for FV HE Scheme
3 participants