PySyft icon indicating copy to clipboard operation
PySyft copied to clipboard

Investigate and refactor mul_and_div in FPT

Open Yugandhartripathi opened this issue 6 years ago • 2 comments

Describe the issue Now that we support negative value of shares below code segment in mul_and_div in precision.py is not useful because it is essentially not doing anything just breaking down the share values based on whether it's positive or negative into pos_self and neg_self and then adding them element-wise to get back the original tensor with no changes.

But if we remove this then linalg functions(like DASH, crypto_lr etc) break by giving type mismatch error in division.

            # sgn_self is 1 when new_self is positive else it's 0
            # The comparison is different if new_self is a torch tensor or an AST
            sgn_self = (new_self > 0).type(self.torch_dtype)
            pos_self = new_self * sgn_self
            neg_self = new_self * (sgn_self - 1)
            new_self = neg_self + pos_self

Expected solution

This can be removed and refactored for a performance boost.

Yugandhartripathi avatar Apr 23 '20 11:04 Yugandhartripathi

This issue has been marked stale because it has been open 30 days with no activity. Leave a comment or remove the stale label to unmark it. Otherwise, this will be closed in 7 days.

github-actions[bot] avatar May 29 '20 00:05 github-actions[bot]

This issue has been marked stale because it has been open 30 days with no activity. Leave a comment or remove the stale label to unmark it. Otherwise, this will be closed in 7 days.

github-actions[bot] avatar Jun 30 '20 00:06 github-actions[bot]