-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve context and tensor implemention #4133
base: feature/heterogeneous-acceleration-architecture
Are you sure you want to change the base?
feat: improve context and tensor implemention #4133
Conversation
Signed-off-by: weiwee <[email protected]>
Signed-off-by: weiwee <[email protected]>
Signed-off-by: weiwee <[email protected]>
import phe | ||
|
||
try: | ||
import gmpy2 | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[autopep8] reported by reviewdog 🐶
except: | |
except BaseException: |
Signed-off-by: weiwee <[email protected]>
Signed-off-by: weiwee <[email protected]>
python/fate_arch/tensor/_tensor.py
Outdated
f"keygen for kind<{kind}>-distributed<{self.distributed}>-device<{self.device}> is not implemented" | ||
) | ||
|
||
def random_tensor(self, shape, num_partition = 1) -> "FPTensor": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[autopep8] reported by reviewdog 🐶
def random_tensor(self, shape, num_partition = 1) -> "FPTensor": | |
def random_tensor(self, shape, num_partition=1) -> "FPTensor": |
# 1. remote deserializer with objs | ||
ctx._push(parties, key, deserializer) | ||
# 2. remote table | ||
ctx._push(parties, deserializer.table_key, self._tensor) | ||
|
||
class PHETensor: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[autopep8] reported by reviewdog 🐶
class PHETensor: | |
class PHETensor: |
tensor = ctx._pull([party], self.table_key)[0] | ||
return PHETensor(ctx, tensor) | ||
|
||
class FPTensorFederationDeserializer(FederationDeserializer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[autopep8] reported by reviewdog 🐶
class FPTensorFederationDeserializer(FederationDeserializer): | |
class FPTensorFederationDeserializer(FederationDeserializer): |
# 1. remote deserializer with objs | ||
ctx._push(parties, key, deserializer) | ||
# 2. remote table | ||
ctx._push(parties, deserializer.table_key, self._blocks_table) | ||
|
||
class PHETensorDistributed(PHETensorABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[autopep8] reported by reviewdog 🐶
class PHETensorDistributed(PHETensorABC): | |
class PHETensorDistributed(PHETensorABC): |
# 1. remote deserializer with objs | ||
ctx._push(parties, key, deserializer) | ||
# 2. remote table | ||
ctx._push(parties, deserializer.table_key, self._blocks_table) | ||
|
||
class PaillierPHEEncryptorDistributed(PHEEncryptorABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[autopep8] reported by reviewdog 🐶
class PaillierPHEEncryptorDistributed(PHEEncryptorABC): | |
class PaillierPHEEncryptorDistributed(PHEEncryptorABC): |
|
||
block_encrytor, block_decryptor = BlockPaillierCipher.keygen(**kwargs) | ||
return ( | ||
PaillierPHEEncryptorDistributed(block_encrytor), | ||
PaillierPHEDecryptorDistributed(block_decryptor), | ||
) | ||
|
||
class PHETensorFederationDeserializer(FederationDeserializer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[autopep8] reported by reviewdog 🐶
class PHETensorFederationDeserializer(FederationDeserializer): | |
class PHETensorFederationDeserializer(FederationDeserializer): |
tensor._is_transpose = self.is_transpose | ||
return tensor | ||
|
||
class FPTensorFederationDeserializer(FederationDeserializer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[autopep8] reported by reviewdog 🐶
class FPTensorFederationDeserializer(FederationDeserializer): | |
class FPTensorFederationDeserializer(FederationDeserializer): |
Signed-off-by: weiwee <[email protected]>
Signed-off-by: weiwee <[email protected]>
Signed-off-by: weiwee <[email protected]>
Signed-off-by: weiwee <[email protected]>
Signed-off-by: weiwee <[email protected]>
Signed-off-by: weiwee <[email protected]>
No description provided.