!8029 fix static checking of lite ops

Merge pull request !8029 from liuwenhao/master
This commit is contained in:
mindspore-ci-bot 2020-10-30 16:13:53 +08:00 committed by Gitee
commit 0f39e5fcdd
21 changed files with 59 additions and 54 deletions

View File

@ -340,7 +340,7 @@ void DeConvWgMerge(const float *src, float *dst, size_t src_stride, size_t dst_s
return;
}
void _deConvWinograd(const float *tile_in, float *tile_out, float *weight_buf, float *tmp_buf, float *at_buf,
void _deConvWinograd(const float *tile_in, float *tile_out, float *weight_buf, float *tmp_buf, const float *at_buf,
float *a_mid_buf, float *trans_a_buf, bool *transfered, const float *bt_buf, float *b_tmp_buf,
int unit_size, int w_start, int h_start, ConvParameter *conv_param, DeConvParam *deconv_param) {
int winograd_plane = unit_size * unit_size;

View File

@ -79,8 +79,8 @@ void ElementMulAcc(const float *input0, const float *input1, float *output, int
}
}
void UpdataState(float *cell_state, const float *forget_gate, const float *input_gate, float *cell_gate, int batch,
int hidden_size) {
void UpdataState(float *cell_state, const float *forget_gate, const float *input_gate, const float *cell_gate,
int batch, int hidden_size) {
ElementMul(forget_gate, cell_state, cell_state, batch * hidden_size);
ElementMulAcc(input_gate, cell_gate, cell_state, batch * hidden_size);
}

View File

@ -65,7 +65,7 @@ int PrepareResizeBilinear(const int *input_shape, const int *output_shape, bool
}
int ResizeBilinear(const float *input_data, float *output_data, const int *input_shape, const int *output_shape,
const int *y_bottoms, const int *y_tops, int *x_lefts, int *x_rights, float *y_bottom_weights,
const int *y_bottoms, const int *y_tops, int *x_lefts, int *x_rights, const float *y_bottom_weights,
float *x_left_weights, int n_h_begin, int n_h_end) {
if (input_data == NULL || output_data == NULL || input_shape == NULL || output_shape == NULL || y_bottoms == NULL ||
y_tops == NULL || x_lefts == NULL || x_rights == NULL || y_bottom_weights == NULL || x_left_weights == NULL) {
@ -154,8 +154,8 @@ int ResizeBilinear(const float *input_data, float *output_data, const int *input
return NNACL_OK;
}
int InterpRow(const float *src_line, float *linear_output, int new_width, float *x_left_weights, const int *x_lefts,
const int *x_rights, int in_c) {
int InterpRow(const float *src_line, float *linear_output, int new_width, const float *x_left_weights,
const int *x_lefts, const int *x_rights, int in_c) {
int w;
for (w = 0; w < new_width; w++) {
int c = 0;
@ -208,7 +208,7 @@ int InterpCol(const float *bottom_line, const float *top_line, float *output, in
}
int ResizeBilinear2(const float *input_data, float *output_data, const int *input_shape, const int *output_shape,
const int *y_bottoms, const int *y_tops, int *x_lefts, int *x_rights, float *y_bottom_weights,
const int *y_bottoms, const int *y_tops, int *x_lefts, int *x_rights, const float *y_bottom_weights,
float *x_left_weights, float *line0, float *line1, int n_h_begin, int n_h_end) {
if (input_data == NULL || output_data == NULL || input_shape == NULL || output_shape == NULL || y_bottoms == NULL ||
y_tops == NULL || x_lefts == NULL || x_rights == NULL || y_bottom_weights == NULL || x_left_weights == NULL) {

View File

@ -30,11 +30,11 @@ int PrepareResizeBilinear(const int *input_shape, const int *output_shape, bool
int *y_tops, int *x_lefts, int *x_rights, float *y_bottom_weights, float *x_left_weights);
int ResizeBilinear(const float *input_data, float *output_data, const int *input_shape, const int *output_shape,
const int *y_bottoms, const int *y_tops, int *x_lefts, int *x_rights, float *y_bottom_weights,
const int *y_bottoms, const int *y_tops, int *x_lefts, int *x_rights, const float *y_bottom_weights,
float *x_left_weights, int n_h_begin, int n_h_end);
int ResizeBilinear2(const float *input_data, float *output_data, const int *input_shape, const int *output_shape,
const int *y_bottoms, const int *y_tops, int *x_lefts, int *x_rights, float *y_bottom_weights,
const int *y_bottoms, const int *y_tops, int *x_lefts, int *x_rights, const float *y_bottom_weights,
float *x_left_weights, float *line0, float *line1, int n_h_begin, int n_h_end);
int ResizeNearestNeighbor(const float *input_data, float *output_data, const int *input_shape, const int *output_shape,

View File

@ -18,7 +18,7 @@
#ifdef ENABLE_ARM
#include <arm_neon.h>
#endif
void ScaleInner(float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
void ScaleInner(const float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
int outer_end, int axis_size, int inner_size) {
for (int out = outer_start; out < outer_end; out++) {
int out_offset = out * axis_size * inner_size;
@ -43,8 +43,8 @@ void ScaleInner(float *in_data, float *out_data, const float *scale, const float
}
}
void ScaleAxis(float *in_data, float *out_data, const float *scale, const float *offset, int outer_start, int outer_end,
int axis_size) {
void ScaleAxis(const float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
int outer_end, int axis_size) {
for (int out = outer_start; out < outer_end; out++) {
int out_offset = out * axis_size;
int index = 0;
@ -65,7 +65,7 @@ void ScaleAxis(float *in_data, float *out_data, const float *scale, const float
}
}
void DoScale(float *in_data, float *out_data, const float *scale, float *offset, int task_id,
void DoScale(const float *in_data, float *out_data, const float *scale, float *offset, int task_id,
ScaleParameter *scale_param) {
int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_);
int outer_start = task_id * outer_step;
@ -79,7 +79,7 @@ void DoScale(float *in_data, float *out_data, const float *scale, float *offset,
}
}
void ScaleInnerRelu(float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
void ScaleInnerRelu(const float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
int outer_end, int axis_size, int inner_size) {
#ifdef ENABLE_ARM64
float32x4_t zeros = {0, 0, 0, 0};
@ -109,7 +109,7 @@ void ScaleInnerRelu(float *in_data, float *out_data, const float *scale, const f
}
}
void ScaleAxisRelu(float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
void ScaleAxisRelu(const float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
int outer_end, int axis_size) {
#ifdef ENABLE_ARM64
float32x4_t zeros = {0, 0, 0, 0};
@ -136,7 +136,7 @@ void ScaleAxisRelu(float *in_data, float *out_data, const float *scale, const fl
}
}
void DoScaleRelu(float *in_data, float *out_data, const float *scale, float *offset, int task_id,
void DoScaleRelu(const float *in_data, float *out_data, const float *scale, const float *offset, int task_id,
ScaleParameter *scale_param) {
int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_);
int outer_start = task_id * outer_step;
@ -150,7 +150,7 @@ void DoScaleRelu(float *in_data, float *out_data, const float *scale, float *off
}
}
void ScaleInnerRelu6(float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
void ScaleInnerRelu6(const float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
int outer_end, int axis_size, int inner_size) {
#ifdef ENABLE_ARM64
float32x4_t zeros = {0, 0, 0, 0};
@ -181,7 +181,7 @@ void ScaleInnerRelu6(float *in_data, float *out_data, const float *scale, const
}
}
void ScaleAxisRelu6(float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
void ScaleAxisRelu6(const float *in_data, float *out_data, const float *scale, const float *offset, int outer_start,
int outer_end, int axis_size) {
#ifdef ENABLE_ARM64
float32x4_t zeros = {0, 0, 0, 0};
@ -209,7 +209,7 @@ void ScaleAxisRelu6(float *in_data, float *out_data, const float *scale, const f
}
}
void DoScaleRelu6(float *in_data, float *out_data, const float *scale, float *offset, int task_id,
void DoScaleRelu6(const float *in_data, float *out_data, const float *scale, const float *offset, int task_id,
ScaleParameter *scale_param) {
int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_);
int outer_start = task_id * outer_step;

View File

@ -22,11 +22,11 @@
#ifdef __cplusplus
extern "C" {
#endif
void DoScale(float *in_data, float *out_data, const float *scale, float *offset, int task_id,
void DoScale(const float *in_data, float *out_data, const float *scale, float *offset, int task_id,
ScaleParameter *scale_param);
void DoScaleRelu(float *in_data, float *out_data, const float *scale, float *offset, int task_id,
void DoScaleRelu(const float *in_data, float *out_data, const float *scale, const float *offset, int task_id,
ScaleParameter *scale_param);
void DoScaleRelu6(float *in_data, float *out_data, const float *scale, float *offset, int task_id,
void DoScaleRelu6(const float *in_data, float *out_data, const float *scale, const float *offset, int task_id,
ScaleParameter *scale_param);
#ifdef __cplusplus
}

View File

@ -16,7 +16,7 @@
#include "nnacl/fp32/space_to_batch.h"
#include "nnacl/arithmetic_common.h"
void DoSpaceToBatchNHWC(const float *input, float *output, const int *block_sizes, int *in_shape,
void DoSpaceToBatchNHWC(const float *input, float *output, const int *block_sizes, const int *in_shape,
const int *out_shape) {
int out_dim0 = out_shape[0];
int out_dim1 = out_shape[1];

View File

@ -30,7 +30,8 @@ typedef struct SpaceToBatchParameter {
#ifdef __cplusplus
extern "C" {
#endif
void DoSpaceToBatchNHWC(const float *input, float *output, const int *block_sizes, int *in_shape, const int *out_shape);
void DoSpaceToBatchNHWC(const float *input, float *output, const int *block_sizes, const int *in_shape,
const int *out_shape);
void DoSpaceToBatchPaddingNHWC(const float *input, float *output, int *in_shape, const int *padding,
const int *out_shape);
#ifdef __cplusplus

View File

@ -18,7 +18,7 @@
#include "nnacl/errorcode.h"
#include "nnacl/op_base.h"
int SpaceToDepthForNHWC(const float *input, float *output, int *in_shape, const int *out_shape, int shape_size,
int SpaceToDepthForNHWC(const float *input, float *output, const int *in_shape, const int *out_shape, int shape_size,
int block_size, int h_start, int h_end) {
if (input == NULL || output == NULL) {
return NNACL_NULL_PTR;

View File

@ -24,7 +24,7 @@ typedef struct SpaceToDepthParameter {
#ifdef __cplusplus
extern "C" {
#endif
int SpaceToDepthForNHWC(const float *input, float *output, int *in_shape, const int *out_shape, int shape_size,
int SpaceToDepthForNHWC(const float *input, float *output, const int *in_shape, const int *out_shape, int shape_size,
int block_size, int h_start, int h_end);
#ifdef __cplusplus
}

View File

@ -37,7 +37,8 @@ size_t GetStackPreAxisCount(const int *in_shape, int axis) {
return pre_axis_count;
}
void DoStack(const float *const *inputs, size_t input_num, int *in_shape, size_t shape_size, int axis, float *output) {
void DoStack(const float *const *inputs, size_t input_num, const int *in_shape, size_t shape_size, int axis,
float *output) {
size_t copy_num = GetStackCopyNum(axis, in_shape, shape_size);
size_t copy_size = copy_num * sizeof(float);
size_t pre_axis_count = GetStackPreAxisCount(in_shape, axis);
@ -52,7 +53,7 @@ void DoStack(const float *const *inputs, size_t input_num, int *in_shape, size_t
}
}
void DoStackInt32(const int32_t *const *inputs, size_t input_num, int *in_shape, size_t shape_size, int axis,
void DoStackInt32(const int32_t *const *inputs, size_t input_num, const int *in_shape, size_t shape_size, int axis,
int32_t *output) {
size_t copy_num = GetStackCopyNum(axis, in_shape, shape_size);
size_t copy_size = copy_num * sizeof(int32_t);

View File

@ -21,8 +21,9 @@
#ifdef __cplusplus
extern "C" {
#endif
void DoStack(const float *const *inputs, size_t input_num, int *in_shape, size_t shape_size, int axis, float *output);
void DoStackInt32(const int32_t *const *inputs, size_t input_num, int *in_shape, size_t shape_size, int axis,
void DoStack(const float *const *inputs, size_t input_num, const int *in_shape, size_t shape_size, int axis,
float *output);
void DoStackInt32(const int32_t *const *inputs, size_t input_num, const int *in_shape, size_t shape_size, int axis,
int32_t *output);
void DoStackOneInput(const int8_t *input, int8_t *output, size_t data_size);
#ifdef __cplusplus

View File

@ -491,7 +491,7 @@ void ConvDw3x3Int8Pad(int8_t *output_data, const int8_t *input_data, const int16
/*conv depthwise sliding window perchannel int8 begin*/
void DepthwiseBorderPixelInt8(int8_t *dst, const int8_t *src, const int16_t *weight, const int32_t *bias, int height,
int width, int in_kh_step, int in_kw_step, int kernel_w, int8_t *input_zp,
int32_t *out_zp, const int *out_multiplier, int *left_shift, const int *right_shift,
int32_t *out_zp, const int *out_multiplier, const int *left_shift, const int *right_shift,
int32_t *acc_min, int32_t *acc_max) {
int tmp_buffer[C8NUM];
for (int i = 0; i < C8NUM; i++) {
@ -527,7 +527,7 @@ void DepthwiseBorderPixelInt8(int8_t *dst, const int8_t *src, const int16_t *wei
void DepthwiseBorderInt8(int8_t *dst, const int8_t *src, const int16_t *weight, const int32_t *bias, int top,
int bottom, int left, int right, const ConvParameter *conv_param,
const SlidingWindowParam *sliding, int8_t *in_zp, int32_t *out_zp, int *out_multiplier,
const SlidingWindowParam *sliding, int8_t *in_zp, int32_t *out_zp, const int *out_multiplier,
int *left_shift, const int *right_shift, int32_t *acc_min, int32_t *acc_max) {
int8_t *dst_h = dst + top * sliding->out_h_step_;
for (int oh = top; oh < bottom; oh++) {

View File

@ -16,7 +16,7 @@
#include "nnacl/int8/space_to_batch_int8.h"
#include "nnacl/arithmetic_common.h"
void DoSpaceToBatchNHWCInt8(const int8_t *input, int8_t *output, const int *block_sizes, int *in_shape,
void DoSpaceToBatchNHWCInt8(const int8_t *input, int8_t *output, const int *block_sizes, const int *in_shape,
const int *out_shape) {
int out_dim0 = out_shape[0];
int out_dim1 = out_shape[1];
@ -46,7 +46,7 @@ void DoSpaceToBatchNHWCInt8(const int8_t *input, int8_t *output, const int *bloc
}
}
void DoSpaceToBatchPaddingNHWCInt8(const int8_t *input, int8_t *output, int *in_shape, const int *padding,
void DoSpaceToBatchPaddingNHWCInt8(const int8_t *input, int8_t *output, const int *in_shape, const int *padding,
const int *out_shape, int32_t zp) {
int in_h = in_shape[1];
int in_w = in_shape[2];

View File

@ -21,9 +21,9 @@
#ifdef __cplusplus
extern "C" {
#endif
void DoSpaceToBatchNHWCInt8(const int8_t *input, int8_t *output, const int *block_sizes, int *in_shape,
void DoSpaceToBatchNHWCInt8(const int8_t *input, int8_t *output, const int *block_sizes, const int *in_shape,
const int *out_shape);
void DoSpaceToBatchPaddingNHWCInt8(const int8_t *input, int8_t *output, int *in_shape, const int *padding,
void DoSpaceToBatchPaddingNHWCInt8(const int8_t *input, int8_t *output, const int *in_shape, const int *padding,
const int *out_shape, int32_t zp);
#ifdef __cplusplus
}

View File

@ -103,7 +103,7 @@ void T(const float *poly_array, float *matrix_t, int n) {
}
}
int B(float *poly_array, float *matrix_b, int in_unit) {
int B(const float *poly_array, float *matrix_b, int in_unit) {
memset(matrix_b, 0, in_unit * in_unit * sizeof(float));
int n = in_unit - 1;
if ((n * n) > MAX_LEN || (n * in_unit) > MAX_LEN) {

View File

@ -36,7 +36,7 @@ int LT(const float *poly_array, float *matrix_lt, int n);
void T(const float *poly_array, float *matrix_t, int n);
int B(float *poly_array, float *matrix_b, int in_unit);
int B(const float *poly_array, float *matrix_b, int in_unit);
void GenerateIntervalArray(float *array, float interval, int degree);

View File

@ -19,7 +19,7 @@
#include "nnacl/errorcode.h"
void TransposeDim2(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end) {
const int *output_shape, int h_start, int h_end) {
const int stride0 = strides[perm[0]];
const int stride1 = strides[perm[1]];
const int output0 = output_shape[0];
@ -34,7 +34,7 @@ void TransposeDim2(float *in_data, float *out_data, const int *strides, int *out
}
void TransposeDim3(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end) {
const int *output_shape, int h_start, int h_end) {
const int stride0 = strides[perm[0]];
const int stride1 = strides[perm[1]];
const int stride2 = strides[perm[2]];
@ -57,7 +57,7 @@ void TransposeDim3(float *in_data, float *out_data, const int *strides, int *out
}
void TransposeDim4(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end) {
const int *output_shape, int h_start, int h_end) {
const int stride0 = strides[perm[0]];
const int stride1 = strides[perm[1]];
const int stride2 = strides[perm[2]];
@ -89,7 +89,7 @@ void TransposeDim4(float *in_data, float *out_data, const int *strides, int *out
}
void TransposeDim5(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end) {
const int *output_shape, int h_start, int h_end) {
const int stride0 = strides[perm[0]];
const int stride1 = strides[perm[1]];
const int stride2 = strides[perm[2]];
@ -128,7 +128,7 @@ void TransposeDim5(float *in_data, float *out_data, const int *strides, int *out
}
void TransposeDims(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end, int dims, int *size, int *position) {
const int *output_shape, int h_start, int h_end, int dims, int *size, int *position) {
*(size + dims - 1) = 1;
for (int i = dims - 1; i > 0; --i) {
*(size + i - 1) = *(size + i) * output_shape[i];

View File

@ -35,15 +35,15 @@ extern "C" {
int DoTranspose(float *in_data, float *out_data, int *input_shape, int *output_shape,
TransposeParameter *transpose_param, int h_start, int h_end, int *size, int *position);
void TransposeDim2(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end);
const int *output_shape, int h_start, int h_end);
void TransposeDim3(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end);
const int *output_shape, int h_start, int h_end);
void TransposeDim4(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end);
const int *output_shape, int h_start, int h_end);
void TransposeDim5(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end);
const int *output_shape, int h_start, int h_end);
void TransposeDims(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm,
int *output_shape, int h_start, int h_end, int dims, int *size, int *position);
const int *output_shape, int h_start, int h_end, int dims, int *size, int *position);
#ifdef __cplusplus
}
#endif

View File

@ -40,6 +40,7 @@ int BinaryCrossEntropy::UnPackAttr(const Primitive &prim, const std::vector<AnfN
<< schema::EnumNamePrimitiveType(primitive_->value.type) << "is not equal"
<< schema::EnumNamePrimitiveType(schema::PrimitiveType_BinaryCrossEntropy);
delete this->primitive_;
this->primitive_ = nullptr;
return RET_ERROR;
}
if (this->primitive_->value.value == nullptr) {
@ -47,6 +48,7 @@ int BinaryCrossEntropy::UnPackAttr(const Primitive &prim, const std::vector<AnfN
if (attr == nullptr) {
MS_LOG(ERROR) << "new binary cross entropy attr failed!";
delete this->primitive_;
this->primitive_ = nullptr;
return RET_ERROR;
}
// default is mean
@ -55,6 +57,8 @@ int BinaryCrossEntropy::UnPackAttr(const Primitive &prim, const std::vector<AnfN
MS_LOG(ERROR) << "get reduction failed!";
delete this->primitive_;
delete attr;
this->primitive_ = nullptr;
attr = nullptr;
return RET_ERROR;
} else {
reduction = GetValue<string>(prim.GetAttr("reduction"));

View File

@ -88,14 +88,12 @@ void DeConvolutionWinogradCPUKernel::FreeDeconvParam() {
}
}
}
}
if (deconv_param_->compute_units_ != nullptr) {
free(deconv_param_->compute_units_);
deconv_param_->compute_units_ = nullptr;
}
if (deconv_param_->compute_units_ != nullptr) {
free(deconv_param_->compute_units_);
deconv_param_->compute_units_ = nullptr;
}
if (deconv_param_ != nullptr) {
delete (deconv_param_);
deconv_param_ = nullptr;
}