Skip to content
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

Open
wants to merge 11 commits into
base: feature/heterogeneous-acceleration-architecture
Choose a base branch
from

Conversation

sagewe
Copy link
Contributor

@sagewe sagewe commented Jul 21, 2022

No description provided.

Signed-off-by: weiwee <wbwmat@gmail.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
@sagewe sagewe added the arch Architecture related label Jul 21, 2022
@sagewe sagewe self-assigned this Jul 21, 2022
import phe

try:
import gmpy2
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[autopep8] reported by reviewdog 🐶

Suggested change
except:
except BaseException:

Signed-off-by: weiwee <wbwmat@gmail.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
f"keygen for kind<{kind}>-distributed<{self.distributed}>-device<{self.device}> is not implemented"
)

def random_tensor(self, shape, num_partition = 1) -> "FPTensor":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[autopep8] reported by reviewdog 🐶

Suggested change
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[autopep8] reported by reviewdog 🐶

Suggested change
class PHETensor:
class PHETensor:

tensor = ctx._pull([party], self.table_key)[0]
return PHETensor(ctx, tensor)

class FPTensorFederationDeserializer(FederationDeserializer):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[autopep8] reported by reviewdog 🐶

Suggested change
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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[autopep8] reported by reviewdog 🐶

Suggested change
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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[autopep8] reported by reviewdog 🐶

Suggested change
class PaillierPHEEncryptorDistributed(PHEEncryptorABC):
class PaillierPHEEncryptorDistributed(PHEEncryptorABC):


block_encrytor, block_decryptor = BlockPaillierCipher.keygen(**kwargs)
return (
PaillierPHEEncryptorDistributed(block_encrytor),
PaillierPHEDecryptorDistributed(block_decryptor),
)

class PHETensorFederationDeserializer(FederationDeserializer):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[autopep8] reported by reviewdog 🐶

Suggested change
class PHETensorFederationDeserializer(FederationDeserializer):
class PHETensorFederationDeserializer(FederationDeserializer):

tensor._is_transpose = self.is_transpose
return tensor

class FPTensorFederationDeserializer(FederationDeserializer):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[autopep8] reported by reviewdog 🐶

Suggested change
class FPTensorFederationDeserializer(FederationDeserializer):
class FPTensorFederationDeserializer(FederationDeserializer):

Signed-off-by: weiwee <wbwmat@gmail.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch Architecture related
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

1 participant