SyMPC icon indicating copy to clipboard operation
SyMPC copied to clipboard

Type annotations for Approximations #258

Open manel1874 opened this issue 3 years ago • 2 comments

Description

Added type annotations to the approximations module of SyMPC:

  • [x] exponential.py
  • [x] log.py
  • [x] reciprocal.py
  • [x] sigmoid.py
  • [x] softmax.py
  • [x] tanh.py
  • [x] utils.py

This fixes #258.

Affected Dependencies

None.

How has this been tested?

  • Tested each function individually in a jupyter notebook.

Checklist

manel1874 avatar Feb 02 '22 14:02 manel1874

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 avatar Feb 06 '22 19:02 gmuraru

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

gmuraru avatar Apr 18 '22 16:04 gmuraru