Closed YZY010203 closed 2 years ago
Hi, I read the source code of Crypten and find it is quite elegant. But I have a question when I look into the details of MPC functions of MPCTensor
. I find there is another class ArithmeticSharedTensor
actually does things, and MPCTensor
simply calls the methods of ArithmeticSharedTensor
. The MPCTensor
seems like a intermediate class between Crypten
and ArithmeticSharedTensor
. If I have ArithmeticSharedTensor
to do everything about MPC protocols, why the existence of MPCTensor
?
The MPCTensor
uses ArithmeticSharedTensor
to evaluate all linear functions but comparators are implemented in BinarySharedTensor
, which uses a different type of secret sharing (namely, binary secret sharing). The MPCTensor
transforms the secret-shared tensor between arithmetic and binary sharing as needed.
Understand! Thanks for your reply.
The
MPCTensor
usesArithmeticSharedTensor
to evaluate all linear functions but comparators are implemented inBinarySharedTensor
, which uses a different type of secret sharing (namely, binary secret sharing). TheMPCTensor
transforms the secret-shared tensor between arithmetic and binary sharing as needed.
Thanks for your reply.
I find when using MPCTensor
, the type of share is MPCTensor
rather than ArithmeticSharedTensor
or BinarySharedTensor
.
This results in a failure when attempting to conduct XOR/AND on two shares,with the error message unsupported operand type(s) for ^: 'MPCTensor' and 'MPCTensor'.
I would like to understand the reason for this issue.
Thanks!
CrypTensor
is a generic tensor class that implements things like automatic differentiation, but it does not implement the actual secure computation protocol. In particular, it contains a set of abstract functions that any subclass ofCrypTensor
should implement using some (secure) computation protocol.MPCTensor
is a subclass ofCrypTensor
that implements these abstract functions using a particular secure MPC protocol (as described in the CrypTen paper).Note that this design allows a user to implement their own secure computation protocol in their own code (without having to make any changes in CrypTen). Specifically, you could implement your own homomorphic encryption tensor as a subclass of
CrypTensor
. If you register that subclass into CrypTen, you inherit a lot of goodies from CrypTen: in particular, a wide variety of functions (you only implement addition, multiplication, and comparison), automatic differentiation on those function, and the neural network library.