SyMPC
SyMPC copied to clipboard
Type annotations for Approximations #258
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
- [x] I have followed the Contribution Guidelines and Code of Conduct
- [x] I have commented my code following the OpenMined Styleguide
- [ ] I have labelled this PR with the relevant Type labels
- [x] My changes are covered by tests
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.
@manel1874 could you do a rebase? there was a problem with the black
code format tool, but it should be solved now.