From a486a739e1b532f6c9e4b9c66036fd6727eddf57 Mon Sep 17 00:00:00 2001 From: Liufang Sang Date: Wed, 25 Mar 2020 03:45:40 -0500 Subject: [PATCH] fix compile error in win gpu (#23196) * fix compile error in win gpu test=develop * fix compile error in win gpu test=develop * fix compile error in win gpu test=develop --- paddle/fluid/operators/dequantize_log_op.cc | 4 ++-- paddle/fluid/operators/dequantize_log_op.cu | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/dequantize_log_op.cc b/paddle/fluid/operators/dequantize_log_op.cc index af89340c59..bfd26061e3 100644 --- a/paddle/fluid/operators/dequantize_log_op.cc +++ b/paddle/fluid/operators/dequantize_log_op.cc @@ -31,9 +31,9 @@ struct DequantizeFunctor { int ind = in->numel(); for (size_t i = 0; i < (unsigned)ind; i++) { if (input_data[i] < 0) { - output_data[i] = -pow(2, dict_data[input_data[i] + 128]); + output_data[i] = -std::pow(2.0, dict_data[input_data[i] + 128]); } else { - output_data[i] = pow(2, dict_data[input_data[i]]); + output_data[i] = std::pow(2.0, dict_data[input_data[i]]); } } } diff --git a/paddle/fluid/operators/dequantize_log_op.cu b/paddle/fluid/operators/dequantize_log_op.cu index 0e146b6902..57bad318ab 100644 --- a/paddle/fluid/operators/dequantize_log_op.cu +++ b/paddle/fluid/operators/dequantize_log_op.cu @@ -13,6 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/dequantize_log_op.h" +#include "paddle/fluid/operators/math.h" +#include "paddle/fluid/platform/cuda_primitives.h" +#include "paddle/fluid/platform/hostdevice.h" namespace paddle { namespace operators { @@ -23,9 +26,9 @@ __global__ void KeDequantize(const T* in, const float* dict, int num, const int idx = threadIdx.x + blockIdx.x * blockDim.x; if (idx < num) { if (in[idx] < 0) { - out[idx] = -pow(2, dict[in[idx] + 128]); + out[idx] = -std::pow(static_cast(2.0), dict[in[idx] + 128]); } else { - out[idx] = pow(2, dict[in[idx]]); + out[idx] = std::pow(static_cast(2.0), dict[in[idx]]); } } } -- GitLab