Browse Source

!9362 fix code check

From: @zhaozhenlong
Reviewed-by: @zhanghaibo5,@hangangqiang
Signed-off-by: @hangangqiang
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
fd36e0911e
4 changed files with 11 additions and 24 deletions
  1. +0
    -18
      mindspore/lite/nnacl/adder.c
  2. +4
    -4
      mindspore/lite/nnacl/fp32/crop_fp32.c
  3. +6
    -0
      mindspore/lite/nnacl/int8/resize_int8.c
  4. +1
    -2
      mindspore/lite/tools/net_train/net_train.cc

+ 0
- 18
mindspore/lite/nnacl/adder.c View File

@@ -1,18 +0,0 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "nnacl/adder.h"
#include "nnacl/errorcode.h"

+ 4
- 4
mindspore/lite/nnacl/fp32/crop_fp32.c View File

@@ -18,9 +18,9 @@
#include "nnacl/op_base.h"
#include "nnacl/crop_parameter.h"

void Pad4DOffset(const CropParameter *crop_param, int64_t *offset) {
void Pad4DOffset(const CropParameter *crop_param, int64_t *offset, int length) {
int axis = crop_param->axis_;
for (int i = DIMENSION_4D - 1; i >= 0; --i) {
for (int i = length - 1; i >= 0; --i) {
int offset_index = i - axis;
if (offset_index >= 0) {
offset[i] = crop_param->offset_[offset_index];
@@ -33,7 +33,7 @@ void Pad4DOffset(const CropParameter *crop_param, int64_t *offset) {
void Crop4D(const float *input, float *output, const int *in_shape, const int *out_shape,
const CropParameter *crop_param, int thread_id) {
int64_t offset_pad[DIMENSION_4D];
Pad4DOffset(crop_param, offset_pad);
Pad4DOffset(crop_param, offset_pad, DIMENSION_4D);
int out_shape1 = out_shape[1];
int out_shape2 = out_shape[2];
int out_shape3 = out_shape[3];
@@ -68,7 +68,7 @@ void Crop4D(const float *input, float *output, const int *in_shape, const int *o
void Crop4DNoParallel(const float *input, float *output, const int *in_shape, const int *out_shape,
const CropParameter *crop_param) {
int64_t offset_pad[DIMENSION_4D];
Pad4DOffset(crop_param, offset_pad);
Pad4DOffset(crop_param, offset_pad, DIMENSION_4D);
size_t in_dim2_stride = in_shape[3];
size_t in_dim1_stride = in_shape[2] * in_dim2_stride;
size_t in_dim0_stride = in_dim1_stride * in_shape[1];


+ 6
- 0
mindspore/lite/nnacl/int8/resize_int8.c View File

@@ -21,6 +21,9 @@

int ResizeBilinearInt8(const int8_t *input_ptr, int8_t *output_ptr, int batch, int in_h, int in_w, int out_h, int out_w,
int channel, int index, int count, ResizeQuantArg quant_arg) {
if (out_w == 0) {
return NNACL_ERRCODE_DIVISOR_ZERO;
}
int in_plane = in_h * in_w;
int out_plane = out_h * out_w;
for (int n = 0; n < batch; n++) {
@@ -67,6 +70,9 @@ int ResizeBilinearInt8(const int8_t *input_ptr, int8_t *output_ptr, int batch, i
int ResizeBilinearWithFloatScaleInt8(const int8_t *input_ptr, int8_t *output_ptr, int batch, int in_h, int in_w,
int out_h, int out_w, int channel, int index, int count,
ResizeFloatScaleQuantArg quant_arg) {
if (out_w == 0) {
return NNACL_ERRCODE_DIVISOR_ZERO;
}
int in_plane = in_h * in_w;
int out_plane = out_h * out_w;
for (int n = 0; n < batch; n++) {


+ 1
- 2
mindspore/lite/tools/net_train/net_train.cc View File

@@ -472,9 +472,8 @@ void NetTrainFlags::InitInputDataList() {
char *saveptr1 = nullptr;
char *input_list = new char[this->in_data_file_.length() + 1];
snprintf(input_list, this->in_data_file_.length() + 1, "%s", this->in_data_file_.c_str());
char *cur_input;
const char *split_c = ",";
cur_input = strtok_r(input_list, split_c, &saveptr1);
char *cur_input = strtok_r(input_list, split_c, &saveptr1);
while (cur_input != nullptr) {
input_data_list_.emplace_back(cur_input);
cur_input = strtok_r(nullptr, split_c, &saveptr1);


Loading…
Cancel
Save