SyMPC icon indicating copy to clipboard operation
SyMPC copied to clipboard

Wrong Compare result for FSS

Open yeungbo opened this issue 4 years ago • 0 comments

Description

When I using a tensor with big number for compare with 0, it return wrong result from FSS protocal.

How to Reproduce

  1. test code:
import torch

from sympc.session import Session
from sympc.session import SessionManager

from sympc.tensor import MPCTensor

sy.load("sympc")
sy.logger.add(sink="./example.log") 
alice = sy.VirtualMachine(name="alice")
bob = sy.VirtualMachine(name="bob")

alice_client = alice.get_client()
bob_client = bob.get_client()
session = Session(parties=[alice_client, bob_client])
SessionManager.setup_mpc(session)

xx = MPCTensor(secret=torch.tensor([ 8.3800e+06, -4.3851e+07,  9.5642e+07, -3.9772e+07,  4.2322e+07,
          3.7577e+07, -1.6031e+07, -1.7107e+07, -4.2336e+07, -2.4824e+07]),session=session)

zz = xx >= 0
zz.reconstruct()




## Expected Behavior
It should return:
tensor([1., 0., 1., 0., 1., 1., 0., 0., 0., 0.])

However, it return the error result:
tensor([1., 0., 1., 1., 0., 1., 1., 0., 1., 1.])

System Information

  • OS: [Ubuntu 18.04.4 LTS]
  • Language Version: [Python 3.7.11]

yeungbo avatar Jan 12 '22 03:01 yeungbo