Merge pull request !8048 from liuwenhao/mastertags/v1.1.0
| @@ -65,8 +65,8 @@ 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, const float *y_bottom_weights, | |||||
| float *x_left_weights, int n_h_begin, int n_h_end) { | |||||
| const int *y_bottoms, const int *y_tops, const int *x_lefts, const 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 || | 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) { | ||||
| return NNACL_NULL_PTR; | return NNACL_NULL_PTR; | ||||
| @@ -208,8 +208,9 @@ 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, const float *y_bottom_weights, | |||||
| float *x_left_weights, float *line0, float *line1, int n_h_begin, int n_h_end) { | |||||
| const int *y_bottoms, const int *y_tops, const int *x_lefts, const 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 || | 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) { | ||||
| return NNACL_NULL_PTR; | return NNACL_NULL_PTR; | ||||
| @@ -30,12 +30,13 @@ 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, const float *y_bottom_weights, | |||||
| float *x_left_weights, int n_h_begin, int n_h_end); | |||||
| const int *y_bottoms, const int *y_tops, const int *x_lefts, const 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, | 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, const float *y_bottom_weights, | |||||
| float *x_left_weights, float *line0, float *line1, int n_h_begin, int n_h_end); | |||||
| const int *y_bottoms, const int *y_tops, const int *x_lefts, const 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, | int ResizeNearestNeighbor(const float *input_data, float *output_data, const int *input_shape, const int *output_shape, | ||||
| bool align_corners, int tid, int thread_num); | bool align_corners, int tid, int thread_num); | ||||
| @@ -65,7 +65,7 @@ void ScaleAxis(const float *in_data, float *out_data, const float *scale, const | |||||
| } | } | ||||
| } | } | ||||
| void DoScale(const 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, 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; | ||||
| @@ -22,7 +22,7 @@ | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" { | extern "C" { | ||||
| #endif | #endif | ||||
| void DoScale(const 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, const float *offset, int task_id, | |||||
| ScaleParameter *scale_param); | ScaleParameter *scale_param); | ||||
| void DoScaleRelu(const float *in_data, float *out_data, const float *scale, const 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); | ||||
| @@ -46,7 +46,7 @@ void DoSpaceToBatchNHWC(const float *input, float *output, const int *block_size | |||||
| } | } | ||||
| } | } | ||||
| void DoSpaceToBatchPaddingNHWC(const float *input, float *output, int *in_shape, const int *padding, | |||||
| void DoSpaceToBatchPaddingNHWC(const float *input, float *output, const int *in_shape, const int *padding, | |||||
| const int *out_shape) { | const int *out_shape) { | ||||
| int in_h = in_shape[1]; | int in_h = in_shape[1]; | ||||
| int in_w = in_shape[2]; | int in_w = in_shape[2]; | ||||
| @@ -32,7 +32,7 @@ extern "C" { | |||||
| #endif | #endif | ||||
| void DoSpaceToBatchNHWC(const float *input, float *output, const int *block_sizes, const 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); | ||||
| void DoSpaceToBatchPaddingNHWC(const float *input, float *output, int *in_shape, const int *padding, | |||||
| void DoSpaceToBatchPaddingNHWC(const float *input, float *output, const int *in_shape, const int *padding, | |||||
| const int *out_shape); | const int *out_shape); | ||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } | } | ||||
| @@ -528,7 +528,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, const 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) { | |||||
| const 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++) { | ||||
| int ih = oh * conv_param->stride_h_ - conv_param->pad_u_; | int ih = oh * conv_param->stride_h_ - conv_param->pad_u_; | ||||
| @@ -18,7 +18,7 @@ | |||||
| #include <string.h> | #include <string.h> | ||||
| #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(const float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm, | |||||
| const 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]]; | ||||
| @@ -33,7 +33,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(const float *in_data, float *out_data, const int *strides, const int *out_strides, const int *perm, | |||||
| const 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]]; | ||||
| @@ -56,7 +56,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(const float *in_data, float *out_data, const int *strides, const int *out_strides, const int *perm, | |||||
| const 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]]; | ||||
| @@ -88,7 +88,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(const float *in_data, float *out_data, const int *strides, const int *out_strides, const int *perm, | |||||
| const 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]]; | ||||
| @@ -127,7 +127,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(const float *in_data, float *out_data, const int *strides, const int *out_strides, const int *perm, | |||||
| const 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) { | ||||
| @@ -149,7 +149,7 @@ void TransposeDims(float *in_data, float *out_data, const int *strides, int *out | |||||
| } | } | ||||
| } | } | ||||
| int DoTranspose(float *in_data, float *out_data, int *input_shape, int *output_shape, | |||||
| int DoTranspose(const float *in_data, float *out_data, int *input_shape, const 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) { | ||||
| if (in_data == NULL || out_data == NULL) { | if (in_data == NULL || out_data == NULL) { | ||||
| return NNACL_ERR; | return NNACL_ERR; | ||||
| @@ -32,17 +32,17 @@ typedef struct TransposeParameter { | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" { | extern "C" { | ||||
| #endif | #endif | ||||
| int DoTranspose(float *in_data, float *out_data, int *input_shape, int *output_shape, | |||||
| int DoTranspose(const float *in_data, float *out_data, int *input_shape, const 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(const float *in_data, float *out_data, const int *strides, int *out_strides, const int *perm, | |||||
| const 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(const float *in_data, float *out_data, const int *strides, const int *out_strides, const int *perm, | |||||
| const 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(const float *in_data, float *out_data, const int *strides, const int *out_strides, const int *perm, | |||||
| const 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(const float *in_data, float *out_data, const int *strides, const int *out_strides, const int *perm, | |||||
| const 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(const float *in_data, float *out_data, const int *strides, const int *out_strides, const int *perm, | |||||
| const 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 | ||||
| } | } | ||||
| @@ -51,6 +51,7 @@ int BinaryCrossEntropyGrad::UnPackAttr(const Primitive &prim, const std::vector< | |||||
| 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 | ||||