提交 1a9008c4 编写于 作者: P peizhilin

code style fix

test=develop
上级 b2a770cf
...@@ -19,9 +19,9 @@ namespace framework { ...@@ -19,9 +19,9 @@ namespace framework {
namespace ir { namespace ir {
// msvc15 don't support constexpr in correct way. // msvc15 don't support constexpr in correct way.
#if !defined(_WIN32) #if !defined(_WIN32)
constexpr char Node::kControlDepVarName[]; constexpr char Node::kControlDepVarName[];
#else #else
const char Node::kControlDepVarName[] = "__control_var"; const char Node::kControlDepVarName[] = "__control_var";
#endif #endif
std::unique_ptr<Node> CreateNodeForTest(const std::string& name, std::unique_ptr<Node> CreateNodeForTest(const std::string& name,
......
...@@ -150,9 +150,9 @@ void OperatorBase::Run(const Scope& scope, const platform::Place& place) { ...@@ -150,9 +150,9 @@ void OperatorBase::Run(const Scope& scope, const platform::Place& place) {
#endif #endif
} }
// The profile has a process-wide mutex, results in serious performance issue // The profile has a process-wide mutex, results in serious performance issue
// in concurrency scenerio. Here use an `if` to fix this issue. // in concurrency scenerio. Here use an `if` to fix this issue.
// Please not remove the `if`, ask @Superjomn if there are any concern. // Please not remove the `if`, ask @Superjomn if there are any concern.
#ifndef _WIN32 #ifndef _WIN32
if (platform::IsProfileEnabled()) { if (platform::IsProfileEnabled()) {
platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance(); platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance();
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#else #else
#endif #endif
#include <iterator>
#include <algorithm> #include <algorithm>
#include <chrono> // NOLINT #include <chrono> // NOLINT
#include <iterator>
#include <numeric> #include <numeric>
#include <sstream> #include <sstream>
#include <string> #include <string>
......
...@@ -112,7 +112,7 @@ class RowwiseTransformIterator<T, platform::CPUDeviceContext> ...@@ -112,7 +112,7 @@ class RowwiseTransformIterator<T, platform::CPUDeviceContext>
} }
RowwiseTransformIterator<T, platform::CPUDeviceContext> &operator+(int n) { RowwiseTransformIterator<T, platform::CPUDeviceContext> &operator+(int n) {
while(n-- > 0) { while (n-- > 0) {
++i_; ++i_;
if (UNLIKELY(i_ == n_)) { if (UNLIKELY(i_ == n_)) {
i_ = 0; i_ = 0;
...@@ -161,7 +161,7 @@ class MidWiseTransformIterator<T, platform::CPUDeviceContext> ...@@ -161,7 +161,7 @@ class MidWiseTransformIterator<T, platform::CPUDeviceContext>
} }
MidWiseTransformIterator<T, platform::CPUDeviceContext> &operator+(int n) { MidWiseTransformIterator<T, platform::CPUDeviceContext> &operator+(int n) {
while(n-- > 0) { while (n-- > 0) {
++j_; ++j_;
if (UNLIKELY(j_ == post_)) { if (UNLIKELY(j_ == post_)) {
++i_; ++i_;
......
...@@ -24,20 +24,20 @@ ...@@ -24,20 +24,20 @@
#include "glog/logging.h" #include "glog/logging.h"
#if !defined(_WIN32) #if !defined(_WIN32)
#include <dlfcn.h> // dladdr #include <dlfcn.h> // dladdr
#include <execinfo.h> // backtrace #include <execinfo.h> // backtrace
#include <sys/stat.h> #include <sys/stat.h>
#include <algorithm> // std::accumulate #include <algorithm> // std::accumulate
#else #else
#include <stdio.h> #include <io.h> // _popen, _pclose
#include <io.h> // _popen, _pclose #include <stdio.h>
#include <windows.h> #include <windows.h>
#include <numeric> // std::accumulate in msvc #include <numeric> // std::accumulate in msvc
#ifndef S_ISDIR // windows port for sys/stat.h #ifndef S_ISDIR // windows port for sys/stat.h
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) #define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
#endif // S_ISDIR #endif // S_ISDIR
static void *dlsym(void *handle, const char *symbol_name) { static void *dlsym(void *handle, const char *symbol_name) {
FARPROC found_symbol; FARPROC found_symbol;
found_symbol = GetProcAddress((HMODULE)handle, symbol_name); found_symbol = GetProcAddress((HMODULE)handle, symbol_name);
...@@ -45,9 +45,9 @@ ...@@ -45,9 +45,9 @@
throw std::runtime_error(std::string(symbol_name) + " not found."); throw std::runtime_error(std::string(symbol_name) + " not found.");
} }
return reinterpret_cast<void *>(found_symbol); return reinterpret_cast<void *>(found_symbol);
} }
static void *dlopen(const char *filename, int flag) { static void *dlopen(const char *filename, int flag) {
std::string file_name(filename); std::string file_name(filename);
file_name.replace(0, file_name.size() - 1, '/', '\\'); file_name.replace(0, file_name.size() - 1, '/', '\\');
HMODULE hModule = LoadLibrary(file_name.c_str()); HMODULE hModule = LoadLibrary(file_name.c_str());
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
throw std::runtime_error(file_name + " not found."); throw std::runtime_error(file_name + " not found.");
} }
return reinterpret_cast<void *>(hModule); return reinterpret_cast<void *>(hModule);
} }
#endif // !_WIN32 #endif // !_WIN32
......
...@@ -364,7 +364,7 @@ All parameter, weight, gradient are variables in Paddle. ...@@ -364,7 +364,7 @@ All parameter, weight, gradient are variables in Paddle.
}, },
py::return_value_policy::reference) py::return_value_policy::reference)
#endif #endif
; ;
#if !defined(_WIN32) #if !defined(_WIN32)
py::class_<framework::ReaderHolder>(m, "Reader", "") py::class_<framework::ReaderHolder>(m, "Reader", "")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册