Skip to content

Wrong Compare result for FSS #320

@yeungbo

Description

@yeungbo

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions