wkcn commented on a change in pull request #16234: [MXNET-1426] Fix the wrong
result of sum, mean, argmin, argmax when inputs contain inf or nan
URL: https://github.com/apache/incubator-mxnet/pull/16234#discussion_r326923532
##########
File path: 3rdparty/mshadow/mshadow/extension/reduce_with_axis.h
##########
@@ -112,7 +112,7 @@ struct Plan<ReduceWithAxisExp<Reducer, SrcExp, DType,
dimsrc, mask, dimdst>, DTy
index_t z = (x*size_+k)*trailing_+y;
DType tmp = res;
Reducer::Reduce(res, src_.Eval(z/last_, z%last_));
- if (tmp != res) {
+ if (tmp != res && !isnan_typed::IsNan(tmp)) {
Review comment:
`NaN` is treated as greater/less than all other values in argmax/ argmin.
NaN is not equal to any number including NaN.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services