Pysyft: Raise Error when trying to share additively float values

Created on 29 May 2019  路  8Comments  路  Source: OpenMined/PySyft

It makes to sense to do this:

x = torch.Tensor([0.0, 5.1])
x_shared = x.share(bob, alice, crypto_provider=james)
x_shared.get()

And it gives wrong results
We should check that the sharing is made on intgeres / Long / etc and not float

Good first issue

All 8 comments

Hey, someone pinged me in slack about this Issue but Slack isn't very good to save un-responded message threads (https://superuser.com/questions/1199066/why-is-my-slack-dm-list-incomplete) so I lost _you_!
I would be glad to give me info but basically: moving to fixed precision is a constraint of the crypto protocols we use for additive sharing. This means that everything which needs to be secret shared should be in fixed precision (not only the neural network weights). Otherwise this violate the guarantees of correctness of the secret sharing protocols.
Note that you can still broadcast non private values with .send(*workers) which creates a MultiPointerTensor instead of an AdditiveSharedTensor. In that case it can be a float, as long as you don't want to operate it with AdditiveSharedTensors.

@LaRiffle Hey LaRiffle, I was the person who pinged you on Slack. I see Jasopaum is working on the issue. I will ping you for more information if I need it. Thanks!

Note: My username on Slack used to be maxwells_daemon, but I changed it to vghorakavi to help keep things clear.

Thanks @vghorakavi !

Hey, may I work on this issue ?

@pierrepocreau I have not done any work on this issue. Please feel free to work on it.

There are two problems around the maxpool.
Here, to calculate the derivative of maxpool, we use share on a torch.zeros tensor but it is of type FloatTensor.
https://github.com/OpenMined/PySyft/blob/f692ac551d41ebb4546274001ad192434b85e522/syft/frameworks/torch/mpc/securenn.py#L575-L577

Maybe we can use something else then torch.zeros ? or convert it to a LongTensor since it's only zeros.

Then to test the maxpool 2d, we call share on a FloatTensor
https://github.com/OpenMined/PySyft/blob/f6e8fd2d736422695c6c20d3d0e86e4c05600752/test/torch/crypto/test_snn.py#L171-L198

But here didn't we forgot to call fix_precision ? because we clearly have float numbers in the x2 tensor.

Yes, torch.zeros needs a dtype arg which should be same as dtype for FPT. #2982 Once this is completed we will have a proper dtype property associated with the FPT and AST.

3094 solves this one.

Was this page helpful?
0 / 5 - 0 ratings