Browse Source

fix reviewbot warning

tags/v1.0.0
zhanghaibo5@huawei.com 5 years ago
parent
commit
4ba6268d50
5 changed files with 13 additions and 14 deletions
  1. +2
    -2
      mindspore/lite/nnacl/fp32_grad/batch_norm.c
  2. +1
    -1
      mindspore/lite/nnacl/minimal_filtering_generator.h
  3. +0
    -2
      mindspore/lite/nnacl/optimized_kernel.h
  4. +4
    -8
      mindspore/lite/tools/time_profiler/time_profiler.cc
  5. +6
    -1
      mindspore/lite/tools/time_profiler/time_profiler.h

+ 2
- 2
mindspore/lite/nnacl/fp32_grad/batch_norm.c View File

@@ -48,7 +48,7 @@ void backwardX(const float *in, const float *dout, const float *scale, const int
meanVar(in, size, channels, eps, mean, invar);
for (int i = 0; i < size; i++) {
for (int f = 0; f < channels; f++) {
int ix = i*channels + f;
int ix = i * channels + f;
float x_hat = (in[ix] - mean[f]) * invar[f];
float dxhat = dout[ix] * scale[f];
dxhat_sum[f] += dxhat;
@@ -57,7 +57,7 @@ void backwardX(const float *in, const float *dout, const float *scale, const int
}
for (int i = 0; i < size; i++) {
for (int f = 0; f < channels; f++) {
int ix = i*channels + f;
int ix = i * channels + f;
float x_hat = (in[ix] - mean[f]) * invar[f];
float dxhat = dout[ix] * scale[f];
out[ix] = 1.f / size * invar[f] * (size * dxhat - dxhat_sum[f] - x_hat * dxhathat_sum[f]);


+ 1
- 1
mindspore/lite/nnacl/minimal_filtering_generator.h View File

@@ -43,7 +43,7 @@ void MatrixTranspose(float *matrix, float *trans_matrix, int row, int col);
void MatrixMultiply(const float *matrix_a, const float *matrix_b, float *matrix_c, int m, int k, int n);

int CookToomFilter(float *matrix_a, float *matrix_at, float *matrix_b, float *matrix_bt, float *matrix_g,
float *matrix_gt, float coefficient, int out_unit, int filter_size);
float *matrix_gt, float coefficient, int out_unit, int filter_size);

#ifdef ENABLE_ARM
void MatrixMultiplyVec(const float32x4_t *matrix_a, const float32x4_t *matrix_b, float32x4_t *matrix_c,


+ 0
- 2
mindspore/lite/nnacl/optimized_kernel.h View File

@@ -37,7 +37,6 @@ class OptimizeModule {
#ifdef ENABLE_ARM64
int hwcap_type = 16;
uint32_t hwcap = getHwCap(hwcap_type);

if (hwcap & HWCAP_ASIMDDP) {
MS_LOG(INFO) << "Hw cap support SMID Dot Product, hwcap: 0x" << hwcap;
support_optimize_ops = true;
@@ -72,7 +71,6 @@ class Float16Module {
#ifdef ENABLE_ARM64
int hwcap_type = 16;
uint32_t hwcap = getHwCap(hwcap_type);

if (hwcap & HWCAP_FPHP) {
MS_LOG(INFO) << "Hw cap support FP16, hwcap: 0x" << hwcap;
support_fp16 = true;


+ 4
- 8
mindspore/lite/tools/time_profiler/time_profiler.cc View File

@@ -80,6 +80,7 @@ int TimeProfiler::ReadInputFile() {
}
auto input_data = inTensor->MutableData();
memcpy(input_data, bin_buf, tensor_data_size);
delete bin_buf;
return RET_OK;
}

@@ -104,15 +105,10 @@ int TimeProfiler::LoadInput() {
}

int TimeProfiler::InitSession() {
size_t size = 0;
char *graph_buf = ReadFile(_flags->model_path_.c_str(), &size);
if (graph_buf == nullptr) {
MS_LOG(ERROR) << "Load graph failed, path " << _flags->model_path_;
std::cerr << "Load graph failed, path " << _flags->model_path_ << std::endl;
ctx = new (std::nothrow) lite::Context;
if (ctx == nullptr) {
return RET_ERROR;
}

auto ctx = new lite::Context;
ctx->cpu_bind_mode_ = static_cast<CpuBindMode>(_flags->cpu_bind_mode_);
ctx->device_type_ = lite::DT_CPU;
ctx->thread_num_ = _flags->num_threads_;
@@ -239,7 +235,7 @@ int TimeProfiler::Init() {
}

int TimeProfiler::PrintResult(const std::vector<std::string> &title,
const std::map<std::string, std::pair<int, float>> &result) {
const std::map<std::string, std::pair<int, float>> &result) {
std::vector<size_t> columnLenMax(5);
std::vector<std::vector<std::string>> rows;



+ 6
- 1
mindspore/lite/tools/time_profiler/time_profiler.h View File

@@ -57,7 +57,11 @@ class MS_API TimeProfilerFlags : public virtual FlagParser {
class MS_API TimeProfiler {
public:
explicit TimeProfiler(TimeProfilerFlags *flags) : _flags(flags) {}
~TimeProfiler() = default;
~TimeProfiler() {
if (ctx != nullptr) {
delete ctx;
}
}

int Init();
int RunTimeProfiler();
@@ -72,6 +76,7 @@ class MS_API TimeProfiler {
int PrintResult(const std::vector<std::string> &title, const std::map<std::string, std::pair<int, float>> &result);

private:
Context *ctx = nullptr;
TimeProfilerFlags *_flags;
std::vector<mindspore::tensor::MSTensor *> ms_inputs_;
session::LiteSession *session_;


Loading…
Cancel
Save