Skip to content

Implement Default fmod Functionality for Base Tensor Type #46#280

Merged
bharathgs merged 37 commits into
OpenMined:masterfrom
nahuakang:func-fmod
Oct 4, 2017
Merged

Implement Default fmod Functionality for Base Tensor Type #46#280
bharathgs merged 37 commits into
OpenMined:masterfrom
nahuakang:func-fmod

Conversation

@nahuakang

Copy link
Copy Markdown
Member

Hi y'all,

This is another attempt to try pull request and to ask for feedback. Both fmod() and fmod()_ methods are added together with corresponding unit tests. However, fmod() is slightly different from the one in PyTorch as it does not contain the optional parameter out.

Thank you for your time and feedback!

Best,

Nahua

@nahuakang nahuakang changed the title Implement Default fmod and fmod_ Functionality for Base Tensor Type #46 Implement Default fmod Functionality for Base Tensor Type #46 Oct 2, 2017
@aiorla

aiorla commented Oct 3, 2017

Copy link
Copy Markdown
Contributor

Thank you @nahuakang! Can you solve first the style issues that Travis reported? (you can reproduce them locally with pytest && pytest --flake8 or using make test in the latest master)

Also, I think that PR #219 is also trying to tackle #46 but I'm not sure about its status. (ping: @radicalrafi)

@ghost

ghost commented Oct 3, 2017

Copy link
Copy Markdown

PR #219 is supposed to tackle this one will submit final edits today .

@nahuakang

Copy link
Copy Markdown
Member Author

@aiorla Thank you for your feedback. There seems to be a lot of Flake8 errors from 1113-1145. Is this caused by some actions from me? And is the best way to fix style issues just to do it manually?

@radicalrafi Thanks. So I should stop working on this issue now?

@ghost

ghost commented Oct 3, 2017

Copy link
Copy Markdown

P.S I'm running in some trouble with my local env can't seem to fix if yours is good to go I have closed my OLD PR #219

@ghost

ghost commented Oct 3, 2017

Copy link
Copy Markdown

You might need to run flake8 locally or trace the Travis Log and fix the syntax issues .

@nahuakang

Copy link
Copy Markdown
Member Author

@radicalrafi @aiorla Thank you both for your help, and I manually fixed the line and space issues. Travis-CI builds successfully now.

@bharathgs

Copy link
Copy Markdown
Contributor

@nahuakang this looks great, could you please rewrite this in math.py and add the respective methods in tensor.py? (sorry to ask these changes now! 😬) but otherwise we are good to go.
Since this is calculating the element-wise remainder of the division, it better suites over there.
@aiorla

@nahuakang

Copy link
Copy Markdown
Member Author

@bharathgs If I'm understanding you correctly, your advice is:

  1. add fmod() in math.py, and call syft.fmod() in tensor.py instead?
  2. _fmod() stays in tensor.py?

@aiorla

aiorla commented Oct 3, 2017

Copy link
Copy Markdown
Contributor

@bharathgs I won't comment on the function location because I'm still not sure about what rules are we following. (but you may be right)

My feedback about the PR (I was waiting Travis to check it):

  • I think we need to check that divisor is not encrypted (if it's a tensor).
  • I'm not sure why only the first dimension is checked to decide if they have the same shape (self.shape()[0]).

PS: I think PyTorch is a bit inconsistent in its definition. It's not clear if we need the same shape or just for them to be broadcastable... 😟

@bharathgs

bharathgs commented Oct 3, 2017

Copy link
Copy Markdown
Contributor

@aiorla yes you are right (about the feedback)

@nahuakang yes you are right as well. fmod moves to math.py

@nahuakang

Copy link
Copy Markdown
Member Author

@aiorla @bharathgs
I modified fmod() and put it under math.py, and modified fmod_() under tensor.py according to comment from @bharathgs .
While the comment from @aiorla is valid and important, I simply edited the documentation for fmod() and fmod_() this time according to another similar method remainder() (and remainder_()) in tensor.py. So if the divisor cannot be broadcasted due to conflicting shape, numpy.fmod will throw the error.
Let me know if you have any feedback. Thanks!

@aiorla

aiorla commented Oct 3, 2017

Copy link
Copy Markdown
Contributor

Looks 👍 to me. Thanks for your patience @nahuakang!

@bharathgs bharathgs merged commit 608690b into OpenMined:master Oct 4, 2017
bharathgs added a commit that referenced this pull request Oct 4, 2017
madhavajay pushed a commit that referenced this pull request Jun 7, 2021
* __init__.py:
- Fixed a typo in execute_command(command)
- Added documentation to launch_on_heroku function
- Removed unessacery if from launch_on_heroku

utils.py:
- Added documentation

* Updated Part1 example notebook

* Update __init__.py

* Update utils.py

* ran black for formatting on grid
madhavajay pushed a commit that referenced this pull request Jun 7, 2021
* __init__.py:
- Fixed a typo in execute_command(command)
- Added documentation to launch_on_heroku function
- Removed unessacery if from launch_on_heroku

utils.py:
- Added documentation

* Updated Part1 example notebook

* Update __init__.py

* Update utils.py

* ran black for formatting on grid
madhavajay pushed a commit to madhavajay/PySyft that referenced this pull request Feb 12, 2025
refactored client and client config
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.

4 participants