Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

[Backport][v1.6.x] Fix the wrong result of sum, mean, argmin, argmax when inputs contain inf or nan#16884

Merged
ptrendx merged 3 commits intoapache:v1.6.xfrom
wkcn:v1.6.x_fix_meansum_nan_backport
Nov 23, 2019
Merged

[Backport][v1.6.x] Fix the wrong result of sum, mean, argmin, argmax when inputs contain inf or nan#16884
ptrendx merged 3 commits intoapache:v1.6.xfrom
wkcn:v1.6.x_fix_meansum_nan_backport

Conversation

@wkcn
Copy link
Member

@wkcn wkcn commented Nov 22, 2019

Hi, there.
In v1.6.x, there is a bug of reduce operators when the inputs contain inf and nan.
I cherry-pick 52716de into the branch v1.6.x.

Related PR: #16234

…rgmin, argmax when inputs contain inf or nan
const DType neginf) {
DType val = in_data[i];
if (mshadow_op::IsNan<DType>(val)) val = nan;
if (val > 0 && mshadow_op::IsInf(val)) val = posinf;
Copy link
Member Author

@wkcn wkcn Nov 22, 2019

Choose a reason for hiding this comment

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

Do I need to delete the modification in src/operator/tensor/elemwise_unary_op.h?
The class NumpyNanToNumParam was written in other PR, but I only modify several lines (701~703, 760~762) in it.

Copy link
Member Author

@wkcn wkcn left a comment

Choose a reason for hiding this comment

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

Do I need to delete the modification in src/operator/tensor/elemwise_unary_op.h?
The class NumpyNanToNumParam was written in other PR, but I only modify several lines in it.

@ptrendx
Copy link
Member

ptrendx commented Nov 22, 2019

@wkcn is that class part of 1.6? If not, then I agree you should delete those modifications - we do not want to introduce new functionality into 1.6 at this point, just fixes.

@wkcn
Copy link
Member Author

wkcn commented Nov 23, 2019

Hi @ptrendx , I have deleted these modifications : )

@ptrendx ptrendx merged commit e147c94 into apache:v1.6.x Nov 23, 2019
* number is not a number */
namespace isnan_typed {
template<typename DType>
MSHADOW_XINLINE bool IsNan(volatile DType val) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the point of volatile here?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants