fix code check

pull/9362/head
zhaozhenlong 4 years ago
parent b5aec1fd45
commit 3f7cada769

@ -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"

@ -18,9 +18,9 @@
#include "nnacl/op_base.h" #include "nnacl/op_base.h"
#include "nnacl/crop_parameter.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_; 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; int offset_index = i - axis;
if (offset_index >= 0) { if (offset_index >= 0) {
offset[i] = crop_param->offset_[offset_index]; 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, void Crop4D(const float *input, float *output, const int *in_shape, const int *out_shape,
const CropParameter *crop_param, int thread_id) { const CropParameter *crop_param, int thread_id) {
int64_t offset_pad[DIMENSION_4D]; 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_shape1 = out_shape[1];
int out_shape2 = out_shape[2]; int out_shape2 = out_shape[2];
int out_shape3 = out_shape[3]; 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, void Crop4DNoParallel(const float *input, float *output, const int *in_shape, const int *out_shape,
const CropParameter *crop_param) { const CropParameter *crop_param) {
int64_t offset_pad[DIMENSION_4D]; 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_dim2_stride = in_shape[3];
size_t in_dim1_stride = in_shape[2] * in_dim2_stride; size_t in_dim1_stride = in_shape[2] * in_dim2_stride;
size_t in_dim0_stride = in_dim1_stride * in_shape[1]; size_t in_dim0_stride = in_dim1_stride * in_shape[1];

@ -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 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) { 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 in_plane = in_h * in_w;
int out_plane = out_h * out_w; int out_plane = out_h * out_w;
for (int n = 0; n < batch; n++) { 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 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, int out_h, int out_w, int channel, int index, int count,
ResizeFloatScaleQuantArg quant_arg) { ResizeFloatScaleQuantArg quant_arg) {
if (out_w == 0) {
return NNACL_ERRCODE_DIVISOR_ZERO;
}
int in_plane = in_h * in_w; int in_plane = in_h * in_w;
int out_plane = out_h * out_w; int out_plane = out_h * out_w;
for (int n = 0; n < batch; n++) { for (int n = 0; n < batch; n++) {

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

Loading…
Cancel
Save