piiswrong commented on a change in pull request #8012: Proper float64 support 
for unary elemwise operators (mshadow_op.h)
URL: https://github.com/apache/incubator-mxnet/pull/8012#discussion_r140668646
 
 

 ##########
 File path: src/operator/mshadow_op.h
 ##########
 @@ -99,22 +99,30 @@ 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)));
+    return DType(DType(1.0f) / (DType(1.0f) + std::expf(-a)));
   }
 };
+
+template<>
+MSHADOW_XINLINE double sigmoid::Map<double>(double a) {
+  return 1.0 / (1.0 + std::exp(-a));
 
 Review comment:
   instead of specializing for each operator, I think it's better to make a 
templated function
   
   template<typename DType>
   mxnet_math::exp(DType a);
   
   and specialize this.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to