提交 e4719eb4 编写于 作者: M minqiyang

Fix bug in Windows VC 2010

test=develop
上级 5a5c5775
...@@ -50,7 +50,7 @@ template <typename T> ...@@ -50,7 +50,7 @@ template <typename T>
class LRNMKLDNNOpKernel : public paddle::framework::OpKernel<T> { class LRNMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
public: public:
void Compute(const paddle::framework::ExecutionContext& ctx) const override { void Compute(const paddle::framework::ExecutionContext& ctx) const override {
PADDLE_ENFORCE(std::is_same<T, float>::value, PADDLE_ENFORCE(std::is_same<typename T, float>::value,
"MKLDNN LRN must use float data."); "MKLDNN LRN must use float data.");
PADDLE_ENFORCE(paddle::platform::is_cpu_place(ctx.GetPlace()), PADDLE_ENFORCE(paddle::platform::is_cpu_place(ctx.GetPlace()),
"MKLDNN LRN must use CPUPlace."); "MKLDNN LRN must use CPUPlace.");
......
...@@ -258,30 +258,30 @@ inline void throw_on_error(T e) { ...@@ -258,30 +258,30 @@ inline void throw_on_error(T e) {
#define PADDLE_THROW(...) \ #define PADDLE_THROW(...) \
throw ::paddle::platform::EnforceNotMet(__FILE__, __LINE__, __VA_ARGS__) throw ::paddle::platform::EnforceNotMet(__FILE__, __LINE__, __VA_ARGS__)
#define PADDLE_THROW_ERROR(COND, ...) \ #define __PADDLE_THROW_ERROR(COND, ...) \
PADDLE_THROW_I(__VA_ARGS__, \ __PADDLE_THROW_ERROR_I( \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \ __VA_ARGS__, ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \ ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \ ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \ ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \ ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \ ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \ ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \ ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND)) ::paddle::platform::throw_on_error(COND))
#define PADDLE_THROW_I(_, _9, _8, _7, _6, _5, _4, _3, _2, X_, ...) X_; #define __PADDLE_THROW_ERROR_I(_, _9, _8, _7, _6, _5, _4, _3, _2, X_, ...) X_;
#define __PADDLE_UNARY_COMPARE(COND, ...) \ #define __PADDLE_UNARY_COMPARE(COND, ...) \
do { \ do { \
auto __cond = COND; \ auto __cond = COND; \
if (UNLIKELY(::paddle::platform::is_error(__cond))) { \ if (UNLIKELY(::paddle::platform::is_error(__cond))) { \
PADDLE_THROW_ERROR(__cond, __VA_ARGS__); \ __PADDLE_THROW_ERROR(__cond, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#ifndef REPLACE_ENFORCE_GLOG #ifndef REPLACE_ENFORCE_GLOG
#define PADDLE_ENFORCE(COND, ...) \ #define __PADDLE_ENFORCE_I(COND, ...) \
do { \ do { \
try { \ try { \
__PADDLE_UNARY_COMPARE(COND, __VA_ARGS__); \ __PADDLE_UNARY_COMPARE(COND, __VA_ARGS__); \
...@@ -292,9 +292,12 @@ inline void throw_on_error(T e) { ...@@ -292,9 +292,12 @@ inline void throw_on_error(T e) {
} while (0) } while (0)
#else #else
#define PADDLE_ENFORCE(COND, ...) __PADDLE_UNARY_COMPARE(COND, __VA_ARGS__); #define __PADDLE_ENFORCE_I(COND, ...) __PADDLE_UNARY_COMPARE(COND, __VA_ARGS__);
#endif // REPLACE_ENFORCE_GLOG #endif // REPLACE_ENFORCE_GLOG
#define __PADDLE_ENFORCE(args) __PADDLE_ENFORCE_I args
#define PADDLE_ENFORCE(...) __PADDLE_ENFORCE((__VA_ARGS__))
#define PADDLE_THROW_EOF() \ #define PADDLE_THROW_EOF() \
do { \ do { \
throw ::paddle::platform::EOFException("There is no next data.", __FILE__, \ throw ::paddle::platform::EOFException("There is no next data.", __FILE__, \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册