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_r141928388
##########
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:
We can implement our own set of math functions under the namespace
mxnet::math. For example
```
namespace mxnet {
namespace math {
template<typename DType>
DType exp(DType value);
template<>
double exp(double value);
}
}
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services