DEFINE_CAFFE_CPU_UNARY_FUNC(sign, y[i] = caffe_sign<Dtype>(x[i]));
// This returns a nonzero value if the input has its sign bit set.
-// The name sngbit is meant to avoid conflicts with std::signbit in the macro
-bool caffe_signbit(float arg);
-bool caffe_signbit(double arg);
-bool caffe_signbit(long double arg);
-DEFINE_CAFFE_CPU_UNARY_FUNC(sgnbit, y[i] = caffe_signbit(x[i]));
+// The name sngbit is meant to avoid conflicts with std::signbit in the macro.
+// The extra parens are needed because CUDA < 6.5 defines signbit as a macro,
+// and we don't want that to expand here when CUDA headers are also included.
+DEFINE_CAFFE_CPU_UNARY_FUNC(sgnbit, y[i] = (std::signbit)(x[i]));
DEFINE_CAFFE_CPU_UNARY_FUNC(fabs, y[i] = std::fabs(x[i]));
cblas_dscal(n, alpha, y, 1);
}
-
-using std::signbit;
-bool caffe_signbit(float arg) {
- return signbit(arg);
-}
-bool caffe_signbit(double arg) {
- return signbit(arg);
-}
-bool caffe_signbit(long double arg) {
- return signbit(arg);
-}
-
} // namespace caffe