OpenMined / SyMPC

A SMPC companion library for Syft
MIT License
97 stars 39 forks source link

Type annotations for Approximations #258 #322

Open manel1874 opened 2 years ago

manel1874 commented 2 years ago

Description

Added type annotations to the approximations module of SyMPC:

This fixes #258.

Affected Dependencies

None.

How has this been tested?

Checklist

gmuraru commented 2 years ago

Hello @manel1874. Thank you for the PR - I have some suggestions. Probably you will encounter the circular import problem if you import the MPCTensor.

One solution for this will be to create a register decorator that will keep track of all the approximations we have - something like:

@register_approximation("log")
def log(....)

And this decorator will add the functions in a dictionary.

Then in the MPCTensor we will import a wrapper class around that dictionary and use that to call the approximations.

Let me know if this sounds ok - also if you have more questions - feel free to message me on Slack.

gmuraru commented 2 years ago

@manel1874 could you do a rebase? there was a problem with the black code format tool, but it should be solved now.