Fix bug leading to mean and var being NaN if calculated distributed - #2495
Fix bug leading to mean and var being NaN if calculated distributed#2495maliesen wants to merge 9 commits into
Conversation
brownbaerchen
left a comment
There was a problem hiding this comment.
Thanks a lot for spotting this! I have some minor comments but the overall fix is good.
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
for more information, see https://pre-commit.ci
|
Thanks for the review! |
|
I put the pr in draft made as I realized the fix as is would introduce the following regression: This is because if the data (single element) is on the first rank, torch will give nan in https://github.com/helmholtz-analytics/heat/blob/main/heat/core/statistics.py#L2226 which will then be normalized to 0 in https://github.com/helmholtz-analytics/heat/blob/main/heat/core/statistics.py#L2228-L2229 so the The distributed calculation of the corrected variance has a nan bug already before this fix (in the |
|
Closing as superseded by #2507. |
Due Diligence
Description
If the data is distributed so that the first two leading ranks are empty a divison by zero in
merge_momentsleads to mean and variance being calculated asnan. This can be circumvented by early returning what has been merged so far if there is no new actual data coming in.Issue/s resolved: #
Changes proposed:
Type of change
Bug fix (non-breaking change which fixes an issue)
Memory requirements
Performance
Does this change modify the behaviour of other functions? If so, which?
yes / no