-
Notifications
You must be signed in to change notification settings - Fork 56
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
Bug/789 pow binary op performance #793
Conversation
Codecov Report
@@ Coverage Diff @@
## main #793 +/- ##
==========================================
- Coverage 91.12% 90.93% -0.19%
==========================================
Files 65 65
Lines 9976 10143 +167
==========================================
+ Hits 9091 9224 +133
- Misses 885 919 +34
Flags with carried forward coverage won't be shown. Click here to find out more.
|
rerun tests |
heat/core/arithmetics.py
Outdated
if isinstance(t1, DNDarray): | ||
ret = factories.zeros_like(t1) | ||
try: | ||
t2 = manipulations.resplit(t2, t1.split) |
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.
Hey I'm thinking this might backfire. Example: two DNDarrays t1
and t2
.
t1.shape = (100, 8)
and t1.split=1
.
t2.shape = (8,)
.
The shapes are broadcastable and ht.pow(t1, t2)
is legitimate. t2
cannot be split along 1 though, so in the follow-up the assumption is that t2
is not a DNDarray. Line 786 will fail.
I'm wondering if we need so many checks at all. All we need to know is if t1
or t2
is a scalar (with the other one a DNDarray). How about
# t1 is a verified DNDarray
if not hasattr(t2, "dtype"):
ret = torch.pow(t1.larray, t2)
else:
# call binary_op
or something like that? What am I missing?
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.
you are correct. that was an issue with the assumption that i made. i updated the logic in this to correct for this now. it should be able to handle anything you can throw at it (i hope).
rerun tests |
1 similar comment
rerun tests |
…eError for bad shapes
…re when multiplying by bools
…ced. \n\n when used in factories, this can be used in place of assuming that balance is true. \n other changes here related to chunk now returning 4 parameters
…rices for common use-cases
New numbers: local tests: 4 procs -
|
@mtar can you have a look at why this is failing? i dont know why |
Some of this PR has been superseded by the latest implementation of |
Closing this as too stale to update, changes implemented in #1141 |
Description
Optimizations for
pow
Issue/s resolved: #789 although resolved is a strong word...more work required
Changes proposed:
_binary_op
unless absolutely necessary and use a simpler switch insteadType of change
Optimization
Due Diligence
Does this change modify the behaviour of other functions? If so, which?
YES!
comm.chunk
now returns 4 parameters instead of 3!