You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When multiply two large (relative to ring_size) values, the reconstructed result is wrong.
As I see it, when:
a wraparound (or say mod operation) happens in the computation process,
and the scale of the encoder is greater than 1,
then the result will be wrong.
How to Reproduce
Please run the following code, there are two examples showing this bug.
sy.logger.remove()
importtorchfromsympc.sessionimportSessionfromsympc.configimportConfigfromsympc.sessionimportSessionManagerfromsympc.tensorimportMPCTensorparties= [sy.VirtualMachine(name=n).get_root_client() fornin ["alice", "bob"]]
# Example 1:session=Session(parties=parties)
SessionManager.setup_mpc(session)
x_secret=torch.Tensor([1<<30])
x=x_secret.share(session=session)
z=x*3print(f"expect {x_secret*3}, but get {z.reconstruct()}")
# Example 2:session=Session(parties=parties, ring_size=256, config=Config(encoder_base=10, encoder_precision=1))
SessionManager.setup_mpc(session)
x_secret=torch.Tensor([[0.1, -1], [-4, 4]])
x=x_secret.share(session=session)
z=x*3print(f"expect {x_secret*3}, but get {z.reconstruct()}")
The text was updated successfully, but these errors were encountered:
xutongye
changed the title
MPCTensor multiply public value get wrong result
Wrong result of multiplication of a MPCTensor and a public value
Nov 9, 2021
Description
When multiply two large (relative to ring_size) values, the reconstructed result is wrong.
As I see it, when:
mod
operation) happens in the computation process,then the result will be wrong.
How to Reproduce
Please run the following code, there are two examples showing this bug.
The text was updated successfully, but these errors were encountered: