Browse Source

!8029 fix static checking of lite ops

Merge pull request !8029 from liuwenhao/master
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
0f39e5fcdd
21 changed files with 59 additions and 54 deletions
  1. +1
    -1
      mindspore/lite/nnacl/fp32/deconv_winograd.c
  2. +2
    -2
      mindspore/lite/nnacl/fp32/lstm.c
  3. +4
    -4
      mindspore/lite/nnacl/fp32/resize.c
  4. +2
    -2
      mindspore/lite/nnacl/fp32/resize.h
  5. +10
    -10
      mindspore/lite/nnacl/fp32/scale.c
  6. +3
    -3
      mindspore/lite/nnacl/fp32/scale.h
  7. +1
    -1
      mindspore/lite/nnacl/fp32/space_to_batch.c
  8. +2
    -1
      mindspore/lite/nnacl/fp32/space_to_batch.h
  9. +1
    -1
      mindspore/lite/nnacl/fp32/space_to_depth.c
  10. +1
    -1
      mindspore/lite/nnacl/fp32/space_to_depth.h
  11. +3
    -2
      mindspore/lite/nnacl/fp32/stack.c
  12. +3
    -2
      mindspore/lite/nnacl/fp32/stack.h
  13. +2
    -2
      mindspore/lite/nnacl/int8/conv_depthwise_int8.c
  14. +2
    -2
      mindspore/lite/nnacl/int8/space_to_batch_int8.c
  15. +2
    -2
      mindspore/lite/nnacl/int8/space_to_batch_int8.h
  16. +1
    -1
      mindspore/lite/nnacl/minimal_filtering_generator.c
  17. +1
    -1
      mindspore/lite/nnacl/minimal_filtering_generator.h
  18. +5
    -5
      mindspore/lite/nnacl/transpose.c
  19. +5
    -5
      mindspore/lite/nnacl/transpose.h
  20. +4
    -0
      mindspore/lite/src/ops/binary_cross_entropy.cc
  21. +4
    -6
      mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_winograd.cc

+ 1
- 1
mindspore/lite/nnacl/fp32/deconv_winograd.c View File

@@ -340,7 +340,7 @@ void DeConvWgMerge(const float *src, float *dst, size_t src_stride, size_t dst_s
return; 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, 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 unit_size, int w_start, int h_start, ConvParameter *conv_param, DeConvParam *deconv_param) {
int winograd_plane = unit_size * unit_size; int winograd_plane = unit_size * unit_size;


+ 2
- 2
mindspore/lite/nnacl/fp32/lstm.c 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); ElementMul(forget_gate, cell_state, cell_state, batch * hidden_size);
ElementMulAcc(input_gate, cell_gate, cell_state, batch * hidden_size); ElementMulAcc(input_gate, cell_gate, cell_state, batch * hidden_size);
} }


+ 4
- 4
mindspore/lite/nnacl/fp32/resize.c 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, 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) { 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 || 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) { 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; 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; int w;
for (w = 0; w < new_width; w++) { for (w = 0; w < new_width; w++) {
int c = 0; 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, 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) { 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 || 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) { y_tops == NULL || x_lefts == NULL || x_rights == NULL || y_bottom_weights == NULL || x_left_weights == NULL) {


+ 2
- 2
mindspore/lite/nnacl/fp32/resize.h 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 *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, 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); 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, 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); 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, int ResizeNearestNeighbor(const float *input_data, float *output_data, const int *input_shape, const int *output_shape,


+ 10
- 10
mindspore/lite/nnacl/fp32/scale.c View File

@@ -18,7 +18,7 @@
#ifdef ENABLE_ARM #ifdef ENABLE_ARM
#include <arm_neon.h> #include <arm_neon.h>
#endif #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) { int outer_end, int axis_size, int inner_size) {
for (int out = outer_start; out < outer_end; out++) { for (int out = outer_start; out < outer_end; out++) {
int out_offset = out * axis_size * inner_size; 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++) { for (int out = outer_start; out < outer_end; out++) {
int out_offset = out * axis_size; int out_offset = out * axis_size;
int index = 0; 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) { ScaleParameter *scale_param) {
int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_); int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_);
int outer_start = task_id * outer_step; 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) { int outer_end, int axis_size, int inner_size) {
#ifdef ENABLE_ARM64 #ifdef ENABLE_ARM64
float32x4_t zeros = {0, 0, 0, 0}; 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) { int outer_end, int axis_size) {
#ifdef ENABLE_ARM64 #ifdef ENABLE_ARM64
float32x4_t zeros = {0, 0, 0, 0}; 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) { ScaleParameter *scale_param) {
int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_); int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_);
int outer_start = task_id * outer_step; 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) { int outer_end, int axis_size, int inner_size) {
#ifdef ENABLE_ARM64 #ifdef ENABLE_ARM64
float32x4_t zeros = {0, 0, 0, 0}; 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) { int outer_end, int axis_size) {
#ifdef ENABLE_ARM64 #ifdef ENABLE_ARM64
float32x4_t zeros = {0, 0, 0, 0}; 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) { ScaleParameter *scale_param) {
int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_); int outer_step = UP_DIV(scale_param->outer_size_, scale_param->op_parameter_.thread_num_);
int outer_start = task_id * outer_step; int outer_start = task_id * outer_step;


+ 3
- 3
mindspore/lite/nnacl/fp32/scale.h View File

@@ -22,11 +22,11 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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); 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); 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); ScaleParameter *scale_param);
#ifdef __cplusplus #ifdef __cplusplus
} }


+ 1
- 1
mindspore/lite/nnacl/fp32/space_to_batch.c View File

@@ -16,7 +16,7 @@
#include "nnacl/fp32/space_to_batch.h" #include "nnacl/fp32/space_to_batch.h"
#include "nnacl/arithmetic_common.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) { const int *out_shape) {
int out_dim0 = out_shape[0]; int out_dim0 = out_shape[0];
int out_dim1 = out_shape[1]; int out_dim1 = out_shape[1];


+ 2
- 1
mindspore/lite/nnacl/fp32/space_to_batch.h View File

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


+ 1
- 1
mindspore/lite/nnacl/fp32/space_to_depth.c View File

@@ -18,7 +18,7 @@
#include "nnacl/errorcode.h" #include "nnacl/errorcode.h"
#include "nnacl/op_base.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) { int block_size, int h_start, int h_end) {
if (input == NULL || output == NULL) { if (input == NULL || output == NULL) {
return NNACL_NULL_PTR; return NNACL_NULL_PTR;


+ 1
- 1
mindspore/lite/nnacl/fp32/space_to_depth.h View File

@@ -24,7 +24,7 @@ typedef struct SpaceToDepthParameter {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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); int block_size, int h_start, int h_end);
#ifdef __cplusplus #ifdef __cplusplus
} }


+ 3
- 2
mindspore/lite/nnacl/fp32/stack.c View File

@@ -37,7 +37,8 @@ size_t GetStackPreAxisCount(const int *in_shape, int axis) {
return pre_axis_count; 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_num = GetStackCopyNum(axis, in_shape, shape_size);
size_t copy_size = copy_num * sizeof(float); size_t copy_size = copy_num * sizeof(float);
size_t pre_axis_count = GetStackPreAxisCount(in_shape, axis); 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) { int32_t *output) {
size_t copy_num = GetStackCopyNum(axis, in_shape, shape_size); size_t copy_num = GetStackCopyNum(axis, in_shape, shape_size);
size_t copy_size = copy_num * sizeof(int32_t); size_t copy_size = copy_num * sizeof(int32_t);


+ 3
- 2
mindspore/lite/nnacl/fp32/stack.h View File

@@ -21,8 +21,9 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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); int32_t *output);
void DoStackOneInput(const int8_t *input, int8_t *output, size_t data_size); void DoStackOneInput(const int8_t *input, int8_t *output, size_t data_size);
#ifdef __cplusplus #ifdef __cplusplus


+ 2
- 2
mindspore/lite/nnacl/int8/conv_depthwise_int8.c 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*/ /*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, 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, 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) { int32_t *acc_min, int32_t *acc_max) {
int tmp_buffer[C8NUM]; int tmp_buffer[C8NUM];
for (int i = 0; i < C8NUM; i++) { 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, 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, 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) { 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_; int8_t *dst_h = dst + top * sliding->out_h_step_;
for (int oh = top; oh < bottom; oh++) { for (int oh = top; oh < bottom; oh++) {


+ 2
- 2
mindspore/lite/nnacl/int8/space_to_batch_int8.c View File

@@ -16,7 +16,7 @@
#include "nnacl/int8/space_to_batch_int8.h" #include "nnacl/int8/space_to_batch_int8.h"
#include "nnacl/arithmetic_common.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) { const int *out_shape) {
int out_dim0 = out_shape[0]; int out_dim0 = out_shape[0];
int out_dim1 = out_shape[1]; 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) { const int *out_shape, int32_t zp) {
int in_h = in_shape[1]; int in_h = in_shape[1];
int in_w = in_shape[2]; int in_w = in_shape[2];


+ 2
- 2
mindspore/lite/nnacl/int8/space_to_batch_int8.h View File

@@ -21,9 +21,9 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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); 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); const int *out_shape, int32_t zp);
#ifdef __cplusplus #ifdef __cplusplus
} }


+ 1
- 1
mindspore/lite/nnacl/minimal_filtering_generator.c 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)); memset(matrix_b, 0, in_unit * in_unit * sizeof(float));
int n = in_unit - 1; int n = in_unit - 1;
if ((n * n) > MAX_LEN || (n * in_unit) > MAX_LEN) { if ((n * n) > MAX_LEN || (n * in_unit) > MAX_LEN) {


+ 1
- 1
mindspore/lite/nnacl/minimal_filtering_generator.h 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); 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); void GenerateIntervalArray(float *array, float interval, int degree);




+ 5
- 5
mindspore/lite/nnacl/transpose.c View File

@@ -19,7 +19,7 @@
#include "nnacl/errorcode.h" #include "nnacl/errorcode.h"


void TransposeDim2(float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm, 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 stride0 = strides[perm[0]];
const int stride1 = strides[perm[1]]; const int stride1 = strides[perm[1]];
const int output0 = output_shape[0]; 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, 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 stride0 = strides[perm[0]];
const int stride1 = strides[perm[1]]; const int stride1 = strides[perm[1]];
const int stride2 = strides[perm[2]]; 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, 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 stride0 = strides[perm[0]];
const int stride1 = strides[perm[1]]; const int stride1 = strides[perm[1]];
const int stride2 = strides[perm[2]]; 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, 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 stride0 = strides[perm[0]];
const int stride1 = strides[perm[1]]; const int stride1 = strides[perm[1]];
const int stride2 = strides[perm[2]]; 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, 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; *(size + dims - 1) = 1;
for (int i = dims - 1; i > 0; --i) { for (int i = dims - 1; i > 0; --i) {
*(size + i - 1) = *(size + i) * output_shape[i]; *(size + i - 1) = *(size + i) * output_shape[i];


+ 5
- 5
mindspore/lite/nnacl/transpose.h View File

@@ -35,15 +35,15 @@ extern "C" {
int DoTranspose(float *in_data, float *out_data, int *input_shape, int *output_shape, 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); 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, 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, 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, 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, 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, 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 #ifdef __cplusplus
} }
#endif #endif


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


+ 4
- 6
mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_winograd.cc 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_); delete (deconv_param_);
deconv_param_ = nullptr; deconv_param_ = nullptr;
} }


Loading…
Cancel
Save