From a0aa2ec8b5e3e37ba7704f5cc4511efd97a7e479 Mon Sep 17 00:00:00 2001 From: dzhwinter Date: Sun, 2 Sep 2018 20:24:45 +0800 Subject: [PATCH] build compile --- cmake/flags.cmake | 2 +- paddle/fluid/inference/api/helper.h | 5 +++-- paddle/fluid/operators/cum_op.h | 10 ++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 3dffacdacb..d11094e90f 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -160,7 +160,7 @@ if(UNIX AND NOT APPLE) set(LINUX TRUE) endif(UNIX AND NOT APPLE) -set(GPU_COMMON_FLAGS -std=c++11 ${GPU_COMMON_FLAGS}) +set(GPU_COMMON_FLAGS /std:c++14 ${GPU_COMMON_FLAGS}) foreach(flag ${COMMON_FLAGS}) safe_set_cflag(CMAKE_C_FLAGS ${flag}) safe_set_cxxflag(CMAKE_CXX_FLAGS ${flag}) diff --git a/paddle/fluid/inference/api/helper.h b/paddle/fluid/inference/api/helper.h index 4b64c2dc25..1c28428a8f 100644 --- a/paddle/fluid/inference/api/helper.h +++ b/paddle/fluid/inference/api/helper.h @@ -15,6 +15,7 @@ #pragma once #include +#include #include #include #include @@ -25,8 +26,8 @@ namespace paddle { namespace inference { - -static void split(const std::string &str, char sep, std::vector *pieces) { +static void split(const std::string &str, char sep, + std::vector *pieces) { pieces->clear(); if (str.empty()) { return; diff --git a/paddle/fluid/operators/cum_op.h b/paddle/fluid/operators/cum_op.h index 999fdcff90..51227b4907 100644 --- a/paddle/fluid/operators/cum_op.h +++ b/paddle/fluid/operators/cum_op.h @@ -85,14 +85,17 @@ class CumKernel : public framework::OpKernel { template void ComputeImp(Device d, const Dim& dims, X x, Out out, int axis, bool reverse, bool exclusive) const { + Functor func(); if (!reverse) { - out.reshape(dims).device(d) = Functor()(x.reshape(dims), axis, exclusive); + out.reshape(dims).device(d) = + func.apply(x.reshape(dims), axis, exclusive); } else { std::array rev; rev.fill(false); rev[axis] = reverse; out.reshape(dims).device(d) = - Functor()(x.reshape(dims).reverse(rev), axis, exclusive).reverse(rev); + func.apply(x.reshape(dims).reverse(rev), axis, exclusive) + .reverse(rev); } } }; @@ -101,8 +104,7 @@ template struct CumsumFunctor { using ELEMENT_TYPE = T; template - const typename X::TensorScanSumOp operator()(X x, int axis, - bool exclusive) const { + const typename X::TensorScanSumOp apply(X x, int axis, bool exclusive) const { return x.cumsum(axis, exclusive); } }; -- GitLab