提交 3f56474f 编写于 作者: J jiweibo

test=develop pre-commit command to run clang-format

上级 9d70dd4d
......@@ -39,7 +39,7 @@ class LightPredictorImpl : public PaddlePredictor {
};
void LightPredictorImpl::Init(const MobileConfig& config) {
// LightPredictor Only support NaiveBuffer backend in publish lib
// LightPredictor Only support NaiveBuffer backend in publish lib
#ifdef LITE_WITH_ARM
lite::DeviceInfo::Init();
lite::DeviceInfo::Global().SetRunMode(config.power_mode(), config.threads());
......
......@@ -113,9 +113,14 @@ class LITE_API CxxConfig : public ConfigBase {
class LITE_API MobileConfig : public ConfigBase {
PowerMode mode_{LITE_POWER_HIGH};
int threads_{1};
public:
MobileConfig(Place preferred_place=Place(TARGET(kARM), PRECISION(kFloat), DATALAYOUT(kNCHW)),
PowerMode mode=LITE_POWER_HIGH, int threads=1) : mode_(mode), threads_(threads) {}
public:
MobileConfig(Place preferred_place = Place(TARGET(kARM),
PRECISION(kFloat),
DATALAYOUT(kNCHW)),
PowerMode mode = LITE_POWER_HIGH,
int threads = 1)
: mode_(mode), threads_(threads) {}
void set_power_mode(PowerMode mode) { mode_ = mode; }
void set_threads(int threads) { threads_ = threads; }
......
......@@ -71,12 +71,12 @@ enum class DataLayoutType : int {
NUM = 4, // number of fields.
};
typedef enum {
LITE_POWER_HIGH = 0,
LITE_POWER_LOW = 1,
LITE_POWER_FULL = 2,
LITE_POWER_NO_BIND = 3,
LITE_POWER_RAND_HIGH = 4,
LITE_POWER_RAND_LOW = 5
LITE_POWER_HIGH = 0,
LITE_POWER_LOW = 1,
LITE_POWER_FULL = 2,
LITE_POWER_NO_BIND = 3,
LITE_POWER_RAND_HIGH = 4,
LITE_POWER_RAND_LOW = 5
} PowerMode;
enum class ActivationType : int {
......
......@@ -827,7 +827,7 @@ void DeviceInfo::RequestPowerHighMode(int thread_num) {
int little_core_size = little_core_ids_.size();
active_ids_.clear();
if (big_core_size > 0) {
mode_ =lite_api::PowerMode::LITE_POWER_HIGH;
mode_ = lite_api::PowerMode::LITE_POWER_HIGH;
if (thread_num > big_core_size) {
LOG(ERROR) << "Request thread num: " << thread_num
<< ", exceed the big cores size: " << big_core_size
......@@ -1031,7 +1031,8 @@ int DeviceInfo::Setup() {
}
LOG(INFO) << "Total memory: " << mem_size_ << "KB";
// set default run mode
SetRunMode(lite_api::PowerMode::LITE_POWER_NO_BIND, 1); // use single thread by default
SetRunMode(lite_api::PowerMode::LITE_POWER_NO_BIND,
1); // use single thread by default
return 0;
}
......
......@@ -180,7 +180,8 @@ class MatMulComputeTester : public arena::TestCase {
if (y_dims_.size() > 2) {
int y_inner = y_dims_[y_dims_.size() - 2] * y_dims_[y_dims_.size() - 1];
int o_inner = dim_out_vec[x_dims_.size() - 2] * dim_out_vec[x_dims_.size() - 1];
int o_inner =
dim_out_vec[x_dims_.size() - 2] * dim_out_vec[x_dims_.size() - 1];
for (size_t i = 0; i < x_dims_.count(0, x_dims_.size() - 2); ++i) {
mul_low_efficiency(
DDim({x_dims_[x_dims_.size() - 2], x_dims_[x_dims_.size() - 1]}),
......@@ -193,7 +194,8 @@ class MatMulComputeTester : public arena::TestCase {
out_data + i * o_inner);
}
} else {
int o_inner = dim_out_vec[x_dims_.size() - 2] * dim_out_vec[x_dims_.size() - 1];
int o_inner =
dim_out_vec[x_dims_.size() - 2] * dim_out_vec[x_dims_.size() - 1];
for (size_t i = 0; i < x_dims_.count(0, x_dims_.size() - 2); ++i) {
mul_low_efficiency(
DDim({x_dims_[x_dims_.size() - 2], x_dims_[x_dims_.size() - 1]}),
......@@ -297,10 +299,10 @@ class MatMulComputeTester : public arena::TestCase {
std::vector<float> y_data(y_dims_.production());
for (int i = 0; i < x_dims_.production(); ++i) {
x_data[i] = 1; // i * 1.1;
x_data[i] = 1; // i * 1.1;
}
for (int i = 0; i < y_dims_.production(); ++i) {
y_data[i] = 1; // i * 0.9;
y_data[i] = 1; // i * 0.9;
}
SetCommonTensor(x_, x_dims_, x_data.data());
......
......@@ -33,7 +33,8 @@ void Run(DebugConfig* conf) {
CHECK(conf);
#ifdef LITE_WITH_ARM
DeviceInfo::Init();
DeviceInfo::Global().SetRunMode(lite_api::LITE_POWER_HIGH, conf->arm_thread_num);
DeviceInfo::Global().SetRunMode(lite_api::LITE_POWER_HIGH,
conf->arm_thread_num);
#endif
lite::Predictor predictor;
std::vector<Place> valid_places({
......
......@@ -18,13 +18,13 @@
*/
#pragma once
#include <assert.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <cstdlib>
#include <cstring>
#include <string>
#include <assert.h>
#include "lite/utils/replace_stl/stream.h"
// NOLINTFILE()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册