Pysyft: Pailier Tensor proper testing.

Created on 12 May 2020  路  6Comments  路  Source: OpenMined/PySyft

Describe the bug
Pailier Tensor has serde methods (simplify/detail), but no testing done. I've added a dummy test in test/serde/serde_helpers.py, make_pailier, but no proper testing.

Expected behavior
Proper testing for Pailier tensor.

Good first issue Status Status Type Type

Most helpful comment

Hello!
I would like to work on this.

All 6 comments

Hello!
I would like to work on this.

See #3478 for some additional details.

Hello!
I would like to work on this.

Hi @doringeman ! Where you able to create the tests? I found out that simplify and detail in the PaillierTensor class do not work when the tensor has elements inside. Therefore I have not been able to create the proper tests. Check this code:

from syft.frameworks.torch.tensors.interpreters.paillier import PaillierTensor
import syft as sy
hook = sy.TorchHook(torch)
bob = sy.VirtualWorker(hook, id="bob")

array0 = np.array([]) # 0 dimension array
array1 = np.array([1,4]) # 1 dimension array
array2 = np.array([[5,2,3],[1,4,4],[2,4,4],[2,4,4]]) # 3 or n dimension array

x_tensor0 = torch.Tensor(array0)
x_tensor1 = torch.Tensor(array1)
x_tensor2 = torch.Tensor(array2)

pub, pri = sy.keygen()
x_encrypted0 = x_tensor0.encrypt(protocol="paillier", public_key=pub)
x_encrypted1 = x_tensor1.encrypt(protocol="paillier", public_key=pub)
x_encrypted2 = x_tensor2.encrypt(protocol="paillier", public_key=pub)

simplified0 = PaillierTensor.simplify(worker=bob, tensor=x_encrypted0)
simplified1 = PaillierTensor.simplify(worker=bob, tensor=x_encrypted1)
simplified2 = PaillierTensor.simplify(worker=bob, tensor=x_encrypted2)

detailed0 = PaillierTensor.detail(worker=bob, tensor_tuple=simplified0)
# error here: ValueError: cannot create an OBJECT array from memory buffer
detailed1 = PaillierTensor.detail(worker=bob, tensor_tuple=simplified1)
detailed2 = PaillierTensor.detail(worker=bob, tensor_tuple=simplified2)

Let me know if you were able to solve it. You can contact me in slack as well :)

Hello, @NicoSerranoP

Unfortunately, not yet. You can set it to available if you want to.

@karlhigley @tudorcebere I think I solved this issue. I am just running the tests and will do a pull request tomorrow :)

This issue has been marked stale because it has been open 30 days with no activity. Leave a comment or remove the stale label to unmark it. Otherwise, this will be closed in 7 days.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jvmncs picture jvmncs  路  3Comments

LaRiffle picture LaRiffle  路  3Comments

alberduris picture alberduris  路  3Comments

iamtrask picture iamtrask  路  4Comments

wentaiwu92 picture wentaiwu92  路  4Comments