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

Features/173 stack #608

Merged
merged 34 commits into from
Jul 14, 2020
Merged

Features/173 stack #608

merged 34 commits into from
Jul 14, 2020

Conversation

ClaudiaComito
Copy link
Contributor

@ClaudiaComito ClaudiaComito commented Jun 30, 2020

Description

Implementation of ht.stack(), ht.column_stack(), and ht.row_stack().

ht.stack(arrays, axis) joins a sequence of DNDarrays along a newly created dimension, specified by the argument axis. It uses torch.stack() under the hood. Even in the distributed case, no communication is required, since the stacking by definition happens along a new axis, and the condition split == axis is therefore never verified.

Distribution of output: stack() requires that all arrays in the sequence be split along the same dimension. After stacking, the data are still distributed in the original dimension, however a new dimension has been added, so the original dimension might now be split+1:

  • if axis <= split, output is distributed along split+1
  • if axis > split, output is distributed along split

ht.column_stack(arrays) and ht.row_stack(arrays) stack 1-D or 2-D DNDarrays as columns or rows, respectively, into 2-D DNDarrays. In practice, they stack, if all arrays are 1-D, or concatenate, if at least one of the arrays is 2-D.

Issue/s resolved: #173, #544

Changes proposed:

  • Implement manipulations.stack()
  • Implement manipulations.column_stack()
  • Implement manipulations.row_stack()
  • Implement tests
  • Add documentation and examples

Type of change

  • New feature (non-breaking change which adds functionality)

Due Diligence

  • All split configurations tested
  • Multiple dtypes tested in relevant functions
  • Documentation updated (if needed)
  • Updated changelog.md under the title "Pending Additions"

Does this change modify the behaviour of other functions? If so, which?

no

@codecov
Copy link

codecov bot commented Jun 30, 2020

Codecov Report

Merging #608 into master will increase coverage by 0.02%.
The diff coverage is 99.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #608      +/-   ##
==========================================
+ Coverage   97.49%   97.52%   +0.02%     
==========================================
  Files          77       77              
  Lines       15877    16102     +225     
==========================================
+ Hits        15480    15704     +224     
- Misses        397      398       +1     
Impacted Files Coverage Δ
heat/core/manipulations.py 99.12% <98.71%> (-0.05%) ⬇️
heat/core/tests/test_manipulations.py 99.91% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d116dc3...d0c15e2. Read the comment docs.

@ClaudiaComito ClaudiaComito marked this pull request as draft June 30, 2020 07:20
@ClaudiaComito ClaudiaComito added the enhancement New feature or request label Jun 30, 2020
@ClaudiaComito ClaudiaComito linked an issue Jun 30, 2020 that may be closed by this pull request
@ClaudiaComito ClaudiaComito self-assigned this Jun 30, 2020
@ClaudiaComito ClaudiaComito added this to the 2-week sprint milestone Jun 30, 2020
@ClaudiaComito ClaudiaComito marked this pull request as ready for review July 1, 2020 05:34
@Markus-Goetz
Copy link
Member

bump, merge conflicts

@ClaudiaComito ClaudiaComito removed this from the 2-week sprint milestone Jul 2, 2020
Copy link
Contributor

@Cdebus Cdebus left a comment

Choose a reason for hiding this comment

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

Looks good, I tried playing around with it a bit, didn't come accross any problems.
Only the docstring amendment


The ``axis`` parameter specifies the index of the new axis in the dimensions of the result.
For example, if ``axis=0``, the arrays will be stacked along the first dimension; if ``axis=-1``,
they will be stacked along the last dimension.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe include the note on the split that you mention above in the PR description. That is very useful to know i believe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right. I've added a Notes section about split semantics and references to it in the text.

Cdebus
Cdebus previously approved these changes Jul 14, 2020
@Cdebus Cdebus merged commit 6d7c95c into master Jul 14, 2020
@Cdebus Cdebus deleted the features/173-stack branch July 14, 2020 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement column_stack() Implement stack
4 participants