You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/09/22 02:55:58 UTC

[GitHub] [incubator-mxnet] wkcn commented on a change in pull request #16234: Fix the wrong result of sum(inf, inf) and mean(inf, inf)

wkcn commented on a change in pull request #16234: Fix the wrong result of sum(inf, inf) and mean(inf, inf)
URL: https://github.com/apache/incubator-mxnet/pull/16234#discussion_r326881128
 
 

 ##########
 File path: 3rdparty/mshadow/mshadow/base.h
 ##########
 @@ -791,12 +863,9 @@ struct maximum {
   /*! \brief do reduction into dst */
   template<typename DType>
   MSHADOW_XINLINE static void Reduce(volatile DType& dst,  volatile DType src) { // NOLINT(*)
-    using namespace std;
-#ifdef __CUDACC__
-    dst = ::max(dst, src);
-#else
-    dst = max(dst, src);
-#endif  // __CUDACC__
+    if (!isnan_typed::IsNan(dst)) {
+      if (!(dst > src)) dst = src;
 
 Review comment:
   I'm not sure whether the compiler will optimize it into `dst <= src`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services