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

Type annotations for Approximations #258 #322

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

manel1874
Copy link

@manel1874 manel1874 commented Feb 2, 2022

Description

Added type annotations to the approximations module of SyMPC:

  • exponential.py
  • log.py
  • reciprocal.py
  • sigmoid.py
  • softmax.py
  • tanh.py
  • utils.py

This fixes #258.

Affected Dependencies

None.

How has this been tested?

  • Tested each function individually in a jupyter notebook.

Checklist

@gmuraru
Copy link
Member

gmuraru commented Feb 6, 2022

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.

…ator that keeps track of the approximations we have.
Copy link
Member

@gmuraru gmuraru left a comment

Choose a reason for hiding this comment

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

LGTM! Nice job!

@gmuraru
Copy link
Member

gmuraru commented Apr 18, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type annotations for Approximations
2 participants