未验证 提交 a486a739 编写于 作者: L Liufang Sang 提交者: GitHub

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
上级 e83af019
...@@ -31,9 +31,9 @@ struct DequantizeFunctor<platform::CPUDeviceContext, T> { ...@@ -31,9 +31,9 @@ struct DequantizeFunctor<platform::CPUDeviceContext, T> {
int ind = in->numel(); int ind = in->numel();
for (size_t i = 0; i < (unsigned)ind; i++) { for (size_t i = 0; i < (unsigned)ind; i++) {
if (input_data[i] < 0) { 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 { } else {
output_data[i] = pow(2, dict_data[input_data[i]]); output_data[i] = std::pow(2.0, dict_data[input_data[i]]);
} }
} }
} }
......
...@@ -13,6 +13,9 @@ See the License for the specific language governing permissions and ...@@ -13,6 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "paddle/fluid/operators/dequantize_log_op.h" #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 paddle {
namespace operators { namespace operators {
...@@ -23,9 +26,9 @@ __global__ void KeDequantize(const T* in, const float* dict, int num, ...@@ -23,9 +26,9 @@ __global__ void KeDequantize(const T* in, const float* dict, int num,
const int idx = threadIdx.x + blockIdx.x * blockDim.x; const int idx = threadIdx.x + blockIdx.x * blockDim.x;
if (idx < num) { if (idx < num) {
if (in[idx] < 0) { if (in[idx] < 0) {
out[idx] = -pow(2, dict[in[idx] + 128]); out[idx] = -std::pow(static_cast<float>(2.0), dict[in[idx] + 128]);
} else { } else {
out[idx] = pow(2, dict[in[idx]]); out[idx] = std::pow(static_cast<float>(2.0), dict[in[idx]]);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册