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

Implement broadcast_arrays, broadcast_to #1020

Merged
merged 24 commits into from
Jun 15, 2023
Merged

Conversation

neosunhan
Copy link
Collaborator

@neosunhan neosunhan commented Aug 30, 2022

Description

Implement broadcast_arrays, broadcast_to

Issue/s resolved: #778

Changes proposed:

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

skip ci

@ghost
Copy link

ghost commented Aug 30, 2022

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@ClaudiaComito ClaudiaComito added array API enhancement New feature or request labels Oct 5, 2022
@ClaudiaComito ClaudiaComito marked this pull request as ready for review February 9, 2023 11:11
@codecov
Copy link

codecov bot commented Feb 9, 2023

Codecov Report

Merging #1020 (a2176cc) into main (6ddc295) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

❗ Current head a2176cc differs from pull request most recent head 679f304. Consider uploading reports for the commit 679f304 to get more accurate results

@@            Coverage Diff             @@
##             main    #1020      +/-   ##
==========================================
- Coverage   91.85%   91.80%   -0.06%     
==========================================
  Files          74       72       -2     
  Lines       10712    10514     -198     
==========================================
- Hits         9840     9652     -188     
+ Misses        872      862      -10     
Flag Coverage Δ
unit 91.80% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
heat/core/manipulations.py 98.88% <100.00%> (+0.02%) ⬆️

... and 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@ClaudiaComito ClaudiaComito left a comment

Choose a reason for hiding this comment

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

Thanks a lot @neosunhan and apologies again for the Draft PR mix-up.

These two functions don't return the expected values when the input arrays are distributed. I've suggested a change for broadcast_to that leverages all the broadcasting checks in _operations.__bin_op().

You should be able to reimplement broadcast_arrays using the new version of broadcast_to so that distributed arrays can be broadcasted even if they are distributed along different axes, e.g. this should be possible:

a = ht.arange(100, split=0)
b = ht.arange(200).reshape(2,100)
b.resplit_(axis=1)
# a.split is 0, b.split is 1
ht.broadcast_arrays(a,b)

Thanks a lot!

heat/core/manipulations.py Outdated Show resolved Hide resolved
@ClaudiaComito ClaudiaComito self-assigned this Feb 13, 2023
@ClaudiaComito ClaudiaComito added this to the 1.3.0 milestone Mar 29, 2023
@github-actions
Copy link
Contributor

Thank you for the PR!

@github-actions
Copy link
Contributor

Thank you for the PR!

@ClaudiaComito ClaudiaComito removed their assignment Apr 17, 2023
@mrfh92 mrfh92 self-assigned this Apr 17, 2023
Copy link
Collaborator

@mrfh92 mrfh92 left a comment

Choose a reason for hiding this comment

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

Review for PR #1020 "Implement broadcast_arrays, broadcast_to"

This PR adds two broadcasting-routines known from NumPy to Heat.

As far as I can judge, the code is correct and sufficiently commented. However, I would like to suggest to add some more information into the documentation, either by an example what each of the two routines does for a concrete array or by providing reference to the corresponding NumPy-functionality.

Once these changes have been done, I recommend merging.

heat/core/manipulations.py Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

Thank you for the PR!

@mrfh92 mrfh92 removed their assignment Apr 21, 2023
@mrfh92 mrfh92 assigned mrfh92 and ClaudiaComito and unassigned mrfh92 Apr 21, 2023
@github-actions
Copy link
Contributor

Thank you for the PR!

@github-actions
Copy link
Contributor

Thank you for the PR!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 5, 2023

Thank you for the PR!

@github-actions
Copy link
Contributor

Thank you for the PR!

@github-actions
Copy link
Contributor

Thank you for the PR!

Copy link
Collaborator

@mrfh92 mrfh92 left a comment

Choose a reason for hiding this comment

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

From my point of view the changes look fine. Therefore I recommend merging if the CI runs through.

@mrfh92 mrfh92 dismissed ClaudiaComito’s stale review June 15, 2023 12:44

outdated comment from Feb 09 is still blocking merge

@mrfh92 mrfh92 merged commit 90166e4 into main Jun 15, 2023
@mrfh92 mrfh92 deleted the feature/778-broadcasting branch June 15, 2023 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
array API enhancement New feature or request GSoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement broadcast_arrays, broadcast_to
3 participants