You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/10/15 05:45:50 UTC

[GitHub] piiswrong commented on a change in pull request #8276: Proper float64 support for unary/binary elemwise operators

piiswrong commented on a change in pull request #8276: Proper float64 support for unary/binary elemwise operators
URL: https://github.com/apache/incubator-mxnet/pull/8276#discussion_r144710307
 
 

 ##########
 File path: src/operator/mshadow_op.h
 ##########
 @@ -99,26 +117,35 @@ struct reciprocal_grad {
 struct sigmoid {
   template<typename DType>
   MSHADOW_XINLINE static DType Map(DType a) {
-    return DType(DType(1.0f) / (DType(1.0f) + expf(-a)));
+    float af(static_cast<float>(a));
+    return DType(1.0f / (1.0f + math::exp(-af)));
   }
 };
+
+template<>
+MSHADOW_XINLINE double sigmoid::Map<double>(double a) {
+  return 1.0 / (1.0 + math::exp(-a));
 
 Review comment:
   I'll merge this for 0.12 release. But I think there is a cleaner way to do this that doesn't require specialization
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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