-
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
corrected std function #767
Conversation
Codecov Report
@@ Coverage Diff @@
## master #767 +/- ##
==========================================
- Coverage 95.22% 95.22% -0.01%
==========================================
Files 64 64
Lines 8717 8728 +11
==========================================
+ Hits 8301 8311 +10
- Misses 416 417 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
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.
Thanks @coquelin77, just a few comments:
heat/core/statistics.py
Outdated
if not isinstance(ddof, int): | ||
raise TypeError(f"ddof must be integer, is {type(ddof)}") | ||
elif ddof > 1: | ||
raise NotImplementedError("Not implemented for ddof > 1.") |
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.
this is "only" not implemented for the distributed or GPU case, correct?
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.
i think it wasnt allowed by torch when i wrote that. but i guess it is now. ill take that out. worst case, we put it back in later
heat/core/statistics.py
Outdated
unbiased = bool(ddof) | ||
ddof = 1 if unbiased else ddof | ||
if not x.is_distributed() and str(x.device)[:3] == "cpu": | ||
loc = np.std(x._DNDarray__array.numpy(), axis=axis, ddof=ddof) |
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.
here ddof > 1
would be ok
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.
oh this was because numpy's std function is/was faster than torch's
if not axis: | ||
return np.sqrt(var(x, axis, ddof, **kwargs)) | ||
if not isinstance(ddof, int): | ||
raise TypeError(f"ddof must be integer, is {type(ddof)}") |
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.
This one line is not covered by tests.
Description
see title
Issue/s resolved: #766
Changes proposed:
Type of change
Due Diligence
Does this change modify the behaviour of other functions? If so, which?
no