-
Notifications
You must be signed in to change notification settings - Fork 54
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
Features/179 repeat #674
Features/179 repeat #674
Conversation
…to avoid balanceing
GPU cluster tests are currently disabled on this Pull Request. |
Codecov Report
@@ Coverage Diff @@
## master #674 +/- ##
==========================================
+ Coverage 97.47% 97.53% +0.05%
==========================================
Files 87 87
Lines 17231 17643 +412
==========================================
+ Hits 16796 17208 +412
Misses 435 435
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good. good job!
Thank you! |
ok to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very very minor changes and only a couple questions. good work!
@coquelin77 Thank you! |
Description
Implementation of function
repeat()
based onnp.repeat()
For process-local operations, I use
torch.repeat_interleave
Docs numpy: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Docs pytorch: https://pytorch.org/docs/stable/generated/torch.repeat_interleave.html
Strategy
In the following, only the distributed case (<=>
a.split != None
) will be explained more specifically as the algorithm otherwise results mainly in a direct call of the torch function.axis is None
Implies
a.split = 0
as the (total) result would be in the wrong order otherwise.To assure the correct distribution of
repeats
and syntactical consistency with numpy (repeats
must be 1-dimensional),repeats
has to be reshaped to the global shape ofa
, redistributed along axis 0 and be flattened afterwards.The last step is necessary due to compatibility with torch (1-dimensionality required as in numpy).
axis is not None
Depending on whether
a.split == axis
,repeats
has to be either split along axis 0 (case True) or gathered on all processes (case False). The eventually resulting redistribution of data is needed to assure correct local and therefore global results.Issue/s resolved: #179
Changes proposed:
manipulations.repeat()
Type of change
Due Diligence
Does this change modify the behaviour of other functions? If so, which?
no