From aebccf9d2c9a417cda40cd43b5a9f07eb7235be8 Mon Sep 17 00:00:00 2001 From: xuanyue Date: Fri, 30 Apr 2021 13:09:07 +0800 Subject: [PATCH] remove op_parameter's infer_flag_ --- .../cpu/nnacl/infer/add_sub_grad_infer.c | 2 +- .../cpu/nnacl/infer/addn_infer.c | 2 +- .../cpu/nnacl/infer/argmin_max_infer.c | 2 +- .../cpu/nnacl/infer/arithmetic_infer.c | 2 +- .../cpu/nnacl/infer/audio_spectrogram_infer.c | 2 +- .../cpu/nnacl/infer/batch_to_space_infer.c | 2 +- .../cpu/nnacl/infer/broadcast_to_infer.c | 2 +- .../cpu/nnacl/infer/cast_infer.c | 2 +- .../cpu/nnacl/infer/common_infer.c | 28 ++++- .../cpu/nnacl/infer/common_infer.h | 3 +- .../cpu/nnacl/infer/concat_infer.c | 2 +- .../cpu/nnacl/infer/constant_of_shape_infer.c | 2 +- .../cpu/nnacl/infer/conv2d_infer.c | 2 +- .../cpu/nnacl/infer/crop_and_resize_infer.c | 10 +- .../cpu/nnacl/infer/crop_infer.c | 2 +- .../cpu/nnacl/infer/cumsum_infer.c | 2 +- .../cpu/nnacl/infer/deconv2d_infer.c | 2 +- .../nnacl/infer/dedepthwise_conv2d_infer.c | 2 +- .../cpu/nnacl/infer/depth_to_space_infer.c | 2 +- .../cpu/nnacl/infer/depthwise_conv2d_infer.c | 2 +- .../infer/detection_post_process_infer.c | 2 +- .../cpu/nnacl/infer/dropout_grad_infer.c | 2 +- .../cpu/nnacl/infer/dropout_infer.c | 2 +- .../cpu/nnacl/infer/embedding_lookup_infer.c | 2 +- .../cpu/nnacl/infer/expand_dims_infer.c | 2 +- .../cpu/nnacl/infer/fill_infer.c | 2 +- .../cpu/nnacl/infer/flatten_grad_infer.c | 2 +- .../cpu/nnacl/infer/flatten_infer.c | 2 +- .../cpu/nnacl/infer/full_connection_infer.c | 2 +- .../cpu/nnacl/infer/fused_batchnorm_infer.c | 2 +- .../cpu/nnacl/infer/gather_infer.c | 2 +- .../cpu/nnacl/infer/gather_nd_infer.c | 2 +- .../cpu/nnacl/infer/gru_infer.c | 2 +- .../nnacl/infer/invert_permutation_infer.c | 2 +- .../cpu/nnacl/infer/layer_norm_infer.c | 2 +- .../cpu/nnacl/infer/lin_space_infer.c | 2 +- .../cpu/nnacl/infer/log_softmax_infer.c | 2 +- .../cpu/nnacl/infer/lstm_infer.c | 2 +- .../cpu/nnacl/infer/matmul_infer.c | 2 +- .../cpu/nnacl/infer/max_min_grad_infer.c | 2 +- .../cpu/nnacl/infer/mean_infer.c | 2 +- .../cpu/nnacl/infer/merge_infer.c | 6 +- .../cpu/nnacl/infer/mfcc_infer.c | 2 +- .../cpu/nnacl/infer/one_hot_infer.c | 2 +- .../cpu/nnacl/infer/pad_infer.c | 2 +- .../cpu/nnacl/infer/pooling_infer.c | 2 +- .../cpu/nnacl/infer/power_infer.c | 2 +- .../cpu/nnacl/infer/prior_box_infer.c | 2 +- .../cpu/nnacl/infer/quant_dtype_cast_infer.c | 2 +- .../infer/random_standard_normal_infer.c | 2 +- .../cpu/nnacl/infer/range_infer.c | 2 +- .../cpu/nnacl/infer/rank_infer.c | 2 +- .../cpu/nnacl/infer/reduce_infer.c | 2 +- .../cpu/nnacl/infer/reshape_infer.c | 2 +- .../cpu/nnacl/infer/resize_grad_infer.c | 2 +- .../cpu/nnacl/infer/resize_infer.c | 12 +- .../cpu/nnacl/infer/rfft_infer.c | 2 +- .../cpu/nnacl/infer/roi_pooling_infer.c | 2 +- .../cpu/nnacl/infer/scatter_nd_infer.c | 2 +- .../cpu/nnacl/infer/select_infer.c | 2 +- .../cpu/nnacl/infer/shape_infer.c | 2 +- .../cpu/nnacl/infer/size_infer.c | 2 +- .../cpu/nnacl/infer/slice_infer.c | 2 +- .../cpu/nnacl/infer/softmax_infer.c | 2 +- .../cpu/nnacl/infer/space_to_batch_infer.c | 2 +- .../cpu/nnacl/infer/space_to_batch_nd_infer.c | 2 +- .../cpu/nnacl/infer/space_to_depth_infer.c | 2 +- .../cpu/nnacl/infer/sparse_to_dense_infer.c | 2 +- .../cpu/nnacl/infer/splice_infer.c | 2 +- .../cpu/nnacl/infer/split_infer.c | 2 +- .../nnacl/infer/split_with_over_lap_infer.c | 2 +- .../cpu/nnacl/infer/squeeze_infer.c | 2 +- .../cpu/nnacl/infer/stack_infer.c | 2 +- .../nnacl/infer/strided_slice_grad_infer.c | 2 +- .../cpu/nnacl/infer/strided_slice_infer.c | 2 +- .../cpu/nnacl/infer/switch_infer.c | 5 +- .../nnacl/infer/tensorlist_fromtensor_infer.c | 2 +- .../nnacl/infer/tensorlist_getitem_infer.c | 10 +- .../nnacl/infer/tensorlist_reserve_infer.c | 6 +- .../nnacl/infer/tensorlist_setitem_infer.c | 2 +- .../cpu/nnacl/infer/tensorlist_stack_infer.c | 2 +- .../cpu/nnacl/infer/tile_infer.c | 2 +- .../cpu/nnacl/infer/topk_infer.c | 2 +- .../cpu/nnacl/infer/transpose_infer.c | 2 +- .../cpu/nnacl/infer/uniform_real_infer.c | 2 +- .../cpu/nnacl/infer/unique_infer.c | 2 +- .../cpu/nnacl/infer/unsqueeze_infer.c | 2 +- .../cpu/nnacl/infer/unstack_infer.c | 2 +- .../cpu/nnacl/infer/where_infer.c | 2 +- .../kernel_compiler/cpu/nnacl/op_base.h | 1 - .../nnacl_serializer/nnacl_stream_utils.cc | 3 +- mindspore/lite/micro/coder/session.cc | 2 - mindspore/lite/src/common/tensor_util.cc | 1 + mindspore/lite/src/lite_kernel.cc | 2 - mindspore/lite/src/lite_kernel.h | 11 +- mindspore/lite/src/lite_session.cc | 4 +- mindspore/lite/src/runtime/infer_manager.cc | 3 + .../kernel/arm/base/group_convolution_base.cc | 3 - .../arm/base/group_convolution_creator.h | 3 +- .../runtime/kernel/arm/base/resize_base.cc | 2 +- .../runtime/kernel/arm/fp16/gather_fp16.cc | 2 - .../arm/fp32/convolution_delegate_fp32.cc | 3 +- .../lite/src/runtime/kernel/npu/npu_kernel.h | 3 +- .../runtime/kernel/opencl/kernel/conv2d.cc | 6 +- .../kernel/opencl/kernel/conv2d_transpose.cc | 2 +- .../kernel/opencl/kernel/depthwise_conv2d.cc | 2 +- .../kernel/opencl/kernel/fullconnection.cc | 2 +- .../runtime/kernel/opencl/kernel/gather.cc | 2 +- .../runtime/kernel/opencl/kernel/matmul.cc | 20 ++-- .../runtime/kernel/opencl/kernel/reshape.cc | 2 +- .../runtime/kernel/opencl/kernel/resize.cc | 2 +- .../runtime/kernel/opencl/kernel/to_format.cc | 3 +- .../runtime/kernel/opencl/opencl_fusion.cc | 26 ++--- .../runtime/kernel/opencl/opencl_kernel.cc | 6 +- .../src/runtime/kernel/opencl/opencl_kernel.h | 3 +- .../runtime/kernel/opencl/opencl_subgraph.cc | 12 +- .../runtime/kernel/opencl/opencl_subgraph.h | 2 +- mindspore/lite/src/scheduler.cc | 40 ++----- mindspore/lite/src/scheduler.h | 6 +- mindspore/lite/src/sub_graph_kernel.cc | 13 +-- mindspore/lite/src/sub_graph_kernel.h | 2 - mindspore/lite/test/models_tf_fp16.cfg | 2 +- .../test/ut/nnacl/infer/adam_infer_test.cc | 1 - .../test/ut/nnacl/infer/addn_infer_test.cc | 2 - .../nnacl/infer/apply_momentum_infer_test.cc | 1 - .../test/ut/nnacl/infer/argmax_infer_test.cc | 4 - .../test/ut/nnacl/infer/argmin_infer_test.cc | 4 - .../infer/arithmetic_compare_infer_test.cc | 4 - .../ut/nnacl/infer/arithmetic_infer_test.cc | 4 - .../ut/nnacl/infer/assign_add_infer_test.cc | 1 - .../test/ut/nnacl/infer/assign_infer_test.cc | 1 - .../infer/audio_spectrogram_infer_test.cc | 1 - .../nnacl/infer/batch_to_space_infer_test.cc | 4 - .../ut/nnacl/infer/bias_grad_infer_test.cc | 1 - .../infer/binary_cross_entropy_infer_test.cc | 2 - .../test/ut/nnacl/infer/bn_grad_infer_test.cc | 1 - .../ut/nnacl/infer/broadcast_to_infer_test.cc | 4 - .../test/ut/nnacl/infer/cast_infer_test.cc | 1 - .../test/ut/nnacl/infer/concat_infer_test.cc | 6 - .../infer/constant_of_shape_infer_test.cc | 1 - .../infer/conv2d_grad_filter_infer_test.cc | 1 - .../infer/conv2d_grad_input_infer_test.cc | 1 - .../test/ut/nnacl/infer/conv2d_infer_test.cc | 11 -- .../nnacl/infer/crop_and_resize_infer_test.cc | 2 - .../test/ut/nnacl/infer/crop_infer_test.cc | 1 - .../test/ut/nnacl/infer/cumsum_infer_test.cc | 1 - .../custom_extract_features_infer_test.cc | 2 - .../infer/custom_normalize_infer_test.cc | 2 - .../nnacl/infer/custom_predict_infer_test.cc | 1 - .../ut/nnacl/infer/deconv2d_infer_test.cc | 3 - .../infer/dedepthwise_conv2d_infer_test.cc | 3 - .../nnacl/infer/depth_to_space_infer_test.cc | 5 - .../infer/depthwise_conv2d_infer_test.cc | 11 -- .../detection_post_process_infer_test.cc | 1 - .../ut/nnacl/infer/dropout_grad_infer_test.cc | 1 - .../infer/embedding_lookup_infer_test.cc | 1 - .../ut/nnacl/infer/expand_dims_infer_test.cc | 3 - .../ut/nnacl/infer/fft_imag_infer_test.cc | 1 - .../test/ut/nnacl/infer/fill_infer_test.cc | 4 - .../ut/nnacl/infer/flatten_grad_infer_test.cc | 1 - .../test/ut/nnacl/infer/flatten_infer_test.cc | 4 - .../nnacl/infer/full_connection_infer_test.cc | 3 - .../nnacl/infer/fused_batchnorm_infer_test.cc | 1 - .../test/ut/nnacl/infer/gather_infer_test.cc | 5 - .../ut/nnacl/infer/gather_nd_infer_test.cc | 5 - .../group_conv2d_grad_input_infer_test.cc | 1 - .../test/ut/nnacl/infer/gru_infer_test.cc | 2 - .../infer/hashtable_lookup_infer_test.cc | 1 - .../test/ut/nnacl/infer/infer_manager_test.cc | 3 - .../infer/invert_permutation_infer_test.cc | 1 - .../ut/nnacl/infer/layer_norm_infer_test.cc | 3 - .../nnacl/infer/lsh_projection_infer_test.cc | 3 - .../test/ut/nnacl/infer/lstm_infer_test.cc | 1 - .../test/ut/nnacl/infer/matmul_infer_test.cc | 4 - .../ut/nnacl/infer/max_min_grad_infer_test.cc | 1 - .../test/ut/nnacl/infer/mean_infer_test.cc | 5 - .../test/ut/nnacl/infer/mfcc_infer_test.cc | 1 - .../test/ut/nnacl/infer/one_hot_infer_test.cc | 1 - .../test/ut/nnacl/infer/pad_infer_test.cc | 5 - .../ut/nnacl/infer/pooling_grad_infer_test.cc | 1 - .../test/ut/nnacl/infer/pooling_infer_test.cc | 6 - .../test/ut/nnacl/infer/power_infer_test.cc | 3 - .../infer/quant_dtype_cast_infer_test.cc | 1 - .../random_standard_normal_infer_test.cc | 1 - .../test/ut/nnacl/infer/range_infer_test.cc | 3 - .../test/ut/nnacl/infer/rank_infer_test.cc | 1 - .../test/ut/nnacl/infer/reduce_infer_test.cc | 5 - .../test/ut/nnacl/infer/reshape_infer_test.cc | 10 -- .../test/ut/nnacl/infer/resize_infer_test.cc | 4 - .../test/ut/nnacl/infer/rfft_infer_test.cc | 1 - .../ut/nnacl/infer/roi_pooling_infer_test.cc | 1 - .../ut/nnacl/infer/scatter_nd_infer_test.cc | 1 - .../test/ut/nnacl/infer/select_infer_test.cc | 4 - .../test/ut/nnacl/infer/sgd_infer_test.cc | 1 - .../test/ut/nnacl/infer/shape_infer_test.cc | 1 - .../test/ut/nnacl/infer/size_infer_test.cc | 1 - .../ut/nnacl/infer/skip_gram_infer_test.cc | 1 - .../test/ut/nnacl/infer/slice_infer_test.cc | 4 - .../infer/softmax_cross_entropy_infer_test.cc | 1 - .../test/ut/nnacl/infer/softmax_infer_test.cc | 1 - .../nnacl/infer/space_to_batch_infer_test.cc | 4 - .../infer/space_to_batch_nd_infer_test.cc | 4 - .../nnacl/infer/space_to_depth_infer_test.cc | 2 - .../nnacl/infer/sparse_to_dense_infer_test.cc | 1 - .../test/ut/nnacl/infer/split_infer_test.cc | 5 - .../test/ut/nnacl/infer/squeeze_infer_test.cc | 4 - .../test/ut/nnacl/infer/stack_infer_test.cc | 2 - .../nnacl/infer/strided_slice_infer_test.cc | 7 -- .../infer/tensorlist_fromtensor_infer_test.cc | 1 - .../infer/tensorlist_getitem_infer_test.cc | 1 - .../infer/tensorlist_reserve_infer_test.cc | 1 - .../infer/tensorlist_setitem_infer_test.cc | 1 - .../infer/tensorlist_stack_infer_test.cc | 1 - .../test/ut/nnacl/infer/tile_infer_test.cc | 2 - .../test/ut/nnacl/infer/topk_infer_test.cc | 2 - .../ut/nnacl/infer/transpose_infer_test.cc | 1 - .../test/ut/nnacl/infer/unique_infer_test.cc | 1 - .../infer/unsorted_segment_sum_infer_test.cc | 1 - .../ut/nnacl/infer/unsqueeze_infer_test.cc | 6 - .../test/ut/nnacl/infer/unstack_infer_test.cc | 1 - .../test/ut/nnacl/infer/where_infer_test.cc | 2 - .../test/ut/nnacl/infer/while_infer_test.cc | 1 - .../kernel/arm/common/strided_slice_tests.cc | 6 - .../runtime/kernel/arm/fp32/cumsum_tests.cc | 7 -- .../arm/fp32/fullconnection_fp32_tests.cc | 2 - .../kernel/arm/fp32/transpose_fp32_tests.cc | 3 - .../kernel/arm/int8/slice_int8_tests.cc | 8 -- .../runtime/kernel/opencl/argminmax_tests.cc | 1 - .../kernel/opencl/strided_slice_tests.cc | 1 - mindspore/lite/tools/common/node_util.cc | 1 - .../legacy_optimizer/graph/infershape_pass.cc | 33 +++--- .../legacy_optimizer/graph/infershape_pass.h | 2 +- .../fusion/constant_folding_fusion.cc | 1 - .../tools/optimizer/graph/infershape_pass.cc | 1 - .../tools/optimizer/graph/node_infershape.cc | 108 ++++++++++-------- .../tools/optimizer/graph/node_infershape.h | 2 +- 236 files changed, 283 insertions(+), 583 deletions(-) diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/add_sub_grad_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/add_sub_grad_infer.c index c81971b627..6e5aa5eb25 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/add_sub_grad_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/add_sub_grad_infer.c @@ -33,7 +33,7 @@ int AddSubGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso TensorC *dx1 = outputs[0]; TensorC *dx2 = outputs[1]; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/addn_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/addn_infer.c index 66b1ee9b5a..a736e26ef2 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/addn_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/addn_infer.c @@ -32,7 +32,7 @@ int AddnInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o return NNACL_ERR; } SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/argmin_max_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/argmin_max_infer.c index 184f83ae58..4e2b900719 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/argmin_max_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/argmin_max_infer.c @@ -49,7 +49,7 @@ int ArgMinMaxInferShape(const TensorC *const *inputs, const size_t inputs_size, if (output_2 != NULL) { SetDataTypeFormat(output_2, input); } - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int output_shape[MAX_SHAPE_SIZE] = {0}; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/arithmetic_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/arithmetic_infer.c index 131e7dccb2..c8c1766c81 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/arithmetic_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/arithmetic_infer.c @@ -83,7 +83,7 @@ int ArithmeticInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso size_t input_shape1_size = input1->shape_size_; SetOutputDtypeFormat(input0, input1, output); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input_shape0_size >= MAX_SHAPE_SIZE || input_shape1_size >= MAX_SHAPE_SIZE) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/audio_spectrogram_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/audio_spectrogram_infer.c index fdb5546988..b1169976d0 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/audio_spectrogram_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/audio_spectrogram_infer.c @@ -50,7 +50,7 @@ int AudioSpectrogramInferShape(const TensorC *const *inputs, size_t inputs_size, const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input->shape_size_ != 2) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/batch_to_space_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/batch_to_space_infer.c index 68689086af..32de646fef 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/batch_to_space_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/batch_to_space_infer.c @@ -115,7 +115,7 @@ int BatchToSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, Ten return NNACL_ERR; } SetDataTypeFormat(outputs[0], input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/broadcast_to_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/broadcast_to_infer.c index 6959bde80e..b5aec9ecd4 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/broadcast_to_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/broadcast_to_infer.c @@ -28,7 +28,7 @@ int BroadcastToInferShape(const TensorC *const *inputs, size_t inputs_size, Tens const TensorC *input = inputs[0]; SetDataTypeFormat(outputs[0], input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } BroadcastToParameter *param = (BroadcastToParameter *)parameter; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/cast_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/cast_infer.c index beb01ae077..42632383e9 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/cast_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/cast_infer.c @@ -31,7 +31,7 @@ int CastInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o output->format_ = input->format_; const TensorC *dst_type = inputs[1]; output->data_type_ = *((int *)dst_type->data_); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input->data_type_ != kNumberTypeBool && input->data_type_ != kNumberTypeUInt8 && diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/common_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/common_infer.c index 9fc4c0adea..20c15559ed 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/common_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/common_infer.c @@ -343,7 +343,7 @@ int CommonInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * return NNACL_NULL_PTR; } SetDataTypeFormat(outputs[0], inputs[0]); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } SetShapeTensor(outputs[0], inputs[0]); @@ -356,7 +356,7 @@ int FftInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **ou TensorC *output = outputs[0]; output->data_type_ = kNumberTypeFloat32; output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int input_shape[MAX_SHAPE_SIZE] = {0}; @@ -454,6 +454,30 @@ void VectorCFree(VectorC *vc) { vc->data_ = NULL; } +bool InferFlag(const TensorC *const *inputs, size_t inputs_size) { + if (inputs == NULL) { + return false; + } + for (size_t i = 0; i < inputs_size; i++) { + if (inputs[i] == NULL) { + return false; + } + if (inputs[i]->data_type_ == kObjectTypeTensorType) { + TensorListC *input_tensor_list = (TensorListC *)inputs[i]; + if (input_tensor_list->shape_value_ == -1) { + return false; + } + } else { + for (size_t j = 0; j < inputs[i]->shape_size_; ++j) { + if (inputs[i]->shape_[j] == -1) { + return false; + } + } + } + } + return true; +} + REG_INFER(Abs, PrimType_Abs, CommonInferShape) REG_INFER(AbsGrad, PrimType_AbsGrad, CommonInferShape) REG_INFER(Activation, PrimType_Activation, CommonInferShape) diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/common_infer.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/common_infer.h index 82de600942..446f11b4a4 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/common_infer.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/common_infer.h @@ -139,7 +139,7 @@ typedef struct TensorListC { bool is_ready_; int data_type_; int format_; - + int shape_value_; int tensors_data_type_; // element_data_type_, keep same as c++ int max_elements_num_; int element_shape_[8]; @@ -204,6 +204,7 @@ int VectorCInsert(VectorC *vc, int index, int value); void VectorCErase(VectorC *vc, int index); bool VectorCEqual(VectorC *vc1, VectorC *vc2); void VectorCFree(VectorC *vc); +bool InferFlag(const TensorC *const *inputs, size_t inputs_size); #ifdef __cplusplus } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/concat_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/concat_infer.c index 1c17b1fc25..ad558eca9c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/concat_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/concat_infer.c @@ -29,7 +29,7 @@ int ConcatInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * const TensorC *input0 = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input0); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/constant_of_shape_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/constant_of_shape_infer.c index 1dd438e29e..b9978bc3d6 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/constant_of_shape_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/constant_of_shape_infer.c @@ -31,7 +31,7 @@ int ConstantOfShapeInferShape(const TensorC *const *inputs, size_t inputs_size, ConstantOfShapeParameter *param = (ConstantOfShapeParameter *)parameter; out_tensor->data_type_ = (TypeIdC)(param->data_type_); out_tensor->format_ = in_tensor->format_; - if (!parameter->infer_flag_ || in_tensor->data_ == NULL) { + if (!InferFlag(inputs, inputs_size) || in_tensor->data_ == NULL) { return NNACL_INFER_INVALID; } int size = GetElementNum(in_tensor); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/conv2d_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/conv2d_infer.c index d945a2be47..62cae707cd 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/conv2d_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/conv2d_infer.c @@ -69,7 +69,7 @@ int Conv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * param->group_ = weight_tensor->shape_[0]; } param->output_channel_ = weight_tensor->shape_[0]; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } const int *in_shape = input_tensor->shape_; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/crop_and_resize_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/crop_and_resize_infer.c index 279e7c4650..fe158030ca 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/crop_and_resize_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/crop_and_resize_infer.c @@ -27,16 +27,14 @@ int CropAndResizeInferShape(const TensorC *const *inputs, size_t inputs_size, Te #endif const TensorC *input = inputs[0]; - if (input->shape_size_ != 0 && input->shape_size_ != 4) { - return NNACL_ERR; - } - TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } - + if (input->shape_size_ != 0 && input->shape_size_ != 4) { + return NNACL_ERR; + } int output_shape[MAX_SHAPE_SIZE] = {0}; size_t output_shape_size = 0; if (inputs[1]->data_ != NULL) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/crop_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/crop_infer.c index b1e70c1df5..aa7a4b5ea7 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/crop_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/crop_infer.c @@ -27,7 +27,7 @@ int CropInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o #endif SetDataTypeFormat(outputs[0], inputs[0]); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } SetShapeTensor(outputs[0], inputs[1]); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/cumsum_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/cumsum_infer.c index ff4d1c61a8..18ccdaca8c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/cumsum_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/cumsum_infer.c @@ -29,7 +29,7 @@ int CumsumInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/deconv2d_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/deconv2d_infer.c index 5f77ecc1f7..ce297a26cb 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/deconv2d_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/deconv2d_infer.c @@ -36,7 +36,7 @@ int Deconv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC if (param->group_ == 0) { param->group_ = weight->shape_[0]; } - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int32_t input_h = GetHeight(input); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dedepthwise_conv2d_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dedepthwise_conv2d_infer.c index 20ac637687..4ed2d8a027 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dedepthwise_conv2d_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dedepthwise_conv2d_infer.c @@ -28,7 +28,7 @@ int DeDepthwiseConv2DInferShape(const TensorC *const *inputs, size_t inputs_size const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int input_h = input->shape_[1]; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/depth_to_space_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/depth_to_space_infer.c index ba276f0b6b..e75453efed 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/depth_to_space_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/depth_to_space_infer.c @@ -32,7 +32,7 @@ int DepthToSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, Ten } SetDataTypeFormat(outputs[0], input); DepthToSpaceParameter *param = (DepthToSpaceParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int input_shape[MAX_SHAPE_SIZE] = {0}; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/depthwise_conv2d_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/depthwise_conv2d_infer.c index 7ae3aeb564..d092adda69 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/depthwise_conv2d_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/depthwise_conv2d_infer.c @@ -30,7 +30,7 @@ int DepthwiseConv2dInferShape(const TensorC *const *inputs, size_t inputs_size, SetDataTypeFormat(output, input); ConvParameter *param = (ConvParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int input_h = input->shape_[1]; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/detection_post_process_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/detection_post_process_infer.c index f5cd701655..bb83710200 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/detection_post_process_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/detection_post_process_infer.c @@ -57,7 +57,7 @@ int DetectionPostProcessInferShape(const TensorC *const *inputs, size_t inputs_s detected_scores->data_type_ = kNumberTypeFloat32; num_det->format_ = boxes->format_; num_det->data_type_ = kNumberTypeFloat32; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } const int max_detections = param->max_detections_; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dropout_grad_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dropout_grad_infer.c index 9afe933267..058e65f9d7 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dropout_grad_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dropout_grad_infer.c @@ -29,7 +29,7 @@ int DropoutGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tens const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } SetShapeTensor(output, input); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dropout_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dropout_infer.c index 3645b5d5ee..a6e9a934c5 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dropout_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/dropout_infer.c @@ -29,7 +29,7 @@ int DropoutInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC const TensorC *input = inputs[0]; TensorC *output0 = outputs[0]; SetDataTypeFormat(output0, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } SetShapeTensor(output0, input); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/embedding_lookup_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/embedding_lookup_infer.c index 21c872b792..449b106ec2 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/embedding_lookup_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/embedding_lookup_infer.c @@ -33,7 +33,7 @@ int EmbeddingLookupInferShape(const TensorC *const *inputs, size_t inputs_size, const TensorC *ids = inputs[inputs_size - 1]; TensorC *output = outputs[0]; SetDataTypeFormat(output, params_); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/expand_dims_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/expand_dims_infer.c index 605188d62d..803572932c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/expand_dims_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/expand_dims_infer.c @@ -29,7 +29,7 @@ int ExpandDimsInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/fill_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/fill_infer.c index e0fd92ea1c..d79962273f 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/fill_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/fill_infer.c @@ -35,7 +35,7 @@ int FillInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o for (size_t i = 0; i < dst_shape_tensor->shape_size_; ++i) { num_dims *= dst_shape_tensor->shape_[i]; } - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (num_dims != 0 && dst_shape == NULL) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/flatten_grad_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/flatten_grad_infer.c index 1a28928674..2d5b82a1dc 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/flatten_grad_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/flatten_grad_infer.c @@ -30,7 +30,7 @@ int FlattenGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tens TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/flatten_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/flatten_infer.c index f0d77a120a..3e981f93b7 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/flatten_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/flatten_infer.c @@ -30,7 +30,7 @@ int FlattenInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/full_connection_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/full_connection_infer.c index 98b4f3f6c3..4510ddb92f 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/full_connection_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/full_connection_infer.c @@ -31,7 +31,7 @@ int FullConnectionInferShape(const TensorC *const *inputs, size_t inputs_size, T TensorC *output = outputs[0]; MatMulParameter *param = (MatMulParameter *)parameter; SetDataTypeFormat(output, input0); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if ((param->has_bias_ && inputs_size != 3) || (!param->has_bias_ && inputs_size != 2)) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/fused_batchnorm_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/fused_batchnorm_infer.c index 04eb15ce90..bc05483c46 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/fused_batchnorm_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/fused_batchnorm_infer.c @@ -38,7 +38,7 @@ int FusedBatchNormInferShape(const TensorC *const *inputs, size_t inputs_size, T outputs[5]->shape_size_ = 1; outputs[5]->shape_[0] = 1; } - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } return NNACL_OK; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gather_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gather_infer.c index e8be381ff7..48a5c111ef 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gather_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gather_infer.c @@ -30,7 +30,7 @@ int GatherInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * output->data_type_ = kNumberTypeFloat32; } output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int axis = *((int *)inputs[2]->data_); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gather_nd_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gather_nd_infer.c index 821ea878c3..7f5d63cb19 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gather_nd_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gather_nd_infer.c @@ -31,7 +31,7 @@ int GatherNdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int in_rank = input->shape_size_; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gru_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gru_infer.c index 4013169a32..a451185fe3 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gru_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/gru_infer.c @@ -34,7 +34,7 @@ int GruInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **ou for (int i = 0; i < 2; i++) { SetDataTypeFormat(outputs[i], input); } - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/invert_permutation_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/invert_permutation_infer.c index dc24facc69..a4e24c2a6a 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/invert_permutation_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/invert_permutation_infer.c @@ -29,7 +29,7 @@ int InvertPermutationInferShape(const TensorC *const *inputs, size_t inputs_size const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input->data_type_ != kNumberTypeInt32) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/layer_norm_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/layer_norm_infer.c index ed8590991f..a3149f9bb0 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/layer_norm_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/layer_norm_infer.c @@ -34,7 +34,7 @@ int LayerNormInferShape(const TensorC *const *inputs, size_t inputs_size, Tensor SetDataTypeFormat(output, input); LayerNormParameter *param = (LayerNormParameter *)parameter; - if (!param->op_parameter_.infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } param->begin_norm_axis_ = diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/lin_space_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/lin_space_infer.c index 3698f70b5c..1786da7d60 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/lin_space_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/lin_space_infer.c @@ -31,7 +31,7 @@ int LinSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC output->data_type_ = input->data_type_; output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int *num = (int *)(inputs[2]->data_); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/log_softmax_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/log_softmax_infer.c index a8a16a6f5c..d683facbd9 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/log_softmax_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/log_softmax_infer.c @@ -31,7 +31,7 @@ int LogSoftmaxInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso output->data_type_ = input->data_type_; output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input->shape_size_ > 5) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/lstm_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/lstm_infer.c index 2dc7ee7132..d93ab70c90 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/lstm_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/lstm_infer.c @@ -34,7 +34,7 @@ int LstmInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o } LstmParameter *param = (LstmParameter *)parameter; - if (!param->op_parameter_.infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/matmul_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/matmul_infer.c index 2ed129b70b..6d25cf0f3d 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/matmul_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/matmul_infer.c @@ -32,7 +32,7 @@ int MatmulInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * SetDataTypeFormat(output, input0); MatMulParameter *param = (MatMulParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/max_min_grad_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/max_min_grad_infer.c index 9e15a4d395..a0b385a60e 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/max_min_grad_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/max_min_grad_infer.c @@ -33,7 +33,7 @@ int MaxMinGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso TensorC *dx1 = outputs[0]; TensorC *dx2 = outputs[1]; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/mean_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/mean_infer.c index 906437eb83..caec06c735 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/mean_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/mean_infer.c @@ -28,7 +28,7 @@ int MeanInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } ReduceParameter *param = (ReduceParameter *)parameter; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/merge_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/merge_infer.c index 276c503c7a..b754107f0a 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/merge_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/merge_infer.c @@ -71,11 +71,6 @@ int MergeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** } #endif - if (!parameter->infer_flag_) { - MergeDataTypeInfer((struct TensorC **)inputs, inputs_size, outputs, outputs_size); - return NNACL_INFER_INVALID; - } - const TensorC *const *left_part_inputs = inputs; size_t left_part_inputs_size = inputs_size / 2; @@ -90,6 +85,7 @@ int MergeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** return MergeInfer((TensorC **)right_part_inputs, right_part_inputs_size, outputs, outputs_size); } + MergeDataTypeInfer((struct TensorC **)inputs, inputs_size, outputs, outputs_size); return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/mfcc_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/mfcc_infer.c index bae34ada0e..c3ffa3e2e6 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/mfcc_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/mfcc_infer.c @@ -29,7 +29,7 @@ int MfccInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input->shape_size_ != 3) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/one_hot_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/one_hot_infer.c index f001f03adb..7adfda437d 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/one_hot_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/one_hot_infer.c @@ -38,7 +38,7 @@ int OneHotInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * return NNACL_NULL_PTR; } SetDataTypeFormat(output, on_value); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } OneHotParameter *param = (OneHotParameter *)parameter; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/pad_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/pad_infer.c index da55234393..68e2577aa8 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/pad_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/pad_infer.c @@ -30,7 +30,7 @@ int PadInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **ou TensorC *output = outputs[0]; SetDataTypeFormat(output, input); PadParameter *param = (PadParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/pooling_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/pooling_infer.c index f6767632e3..b23fb1be15 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/pooling_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/pooling_infer.c @@ -31,7 +31,7 @@ int PoolingInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC TensorC *output = outputs[0]; SetDataTypeFormat(output, input); PoolingParameter *param = (PoolingParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int input_h = input->shape_[1]; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/power_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/power_infer.c index 8cc73bea9e..7601b6b64f 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/power_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/power_infer.c @@ -40,7 +40,7 @@ int PowerInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** TensorC *output_tensor = outputs[0]; SetDataTypeFormat(output_tensor, x_tensor); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (exp_tensor != NULL) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/prior_box_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/prior_box_infer.c index bb3373c459..8698384368 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/prior_box_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/prior_box_infer.c @@ -31,7 +31,7 @@ int PriorBoxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC TensorC *output = outputs[0]; output->data_type_ = kNumberTypeFloat32; output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } float different_aspect_ratios[MAX_SHAPE_SIZE * 2 + 1]; // NOTE: flip double the number diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/quant_dtype_cast_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/quant_dtype_cast_infer.c index 5fdc564972..caff0bcf85 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/quant_dtype_cast_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/quant_dtype_cast_infer.c @@ -32,7 +32,7 @@ int QuantDtypeCastInferShape(const TensorC *const *inputs, size_t inputs_size, T QuantDtypeCastParameter *param = (QuantDtypeCastParameter *)parameter; output->data_type_ = param->dstT_; output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } SetShapeTensor(output, input); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/random_standard_normal_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/random_standard_normal_infer.c index ae8640ac41..bb6b69b478 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/random_standard_normal_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/random_standard_normal_infer.c @@ -27,7 +27,7 @@ int RandomStandardNormalInferShape(const TensorC *const *inputs, size_t inputs_s #endif outputs[0]->data_type_ = kNumberTypeFloat32; outputs[0]->format_ = inputs[0]->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/range_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/range_infer.c index b596a79568..5e5a448948 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/range_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/range_infer.c @@ -39,7 +39,7 @@ int RangeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** output->data_type_ = kNumberTypeInt32; } output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/rank_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/rank_infer.c index a0abd7f8cc..6ea9d5d574 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/rank_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/rank_infer.c @@ -29,7 +29,7 @@ int RankInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } output->shape_size_ = 1; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/reduce_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/reduce_infer.c index de1347cd11..26b70809a3 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/reduce_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/reduce_infer.c @@ -63,7 +63,7 @@ int ReduceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * TensorC *output = outputs[0]; SetDataTypeFormat(output, input); ReduceParameter *param = (ReduceParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } bool keep_dims = param->keep_dims_; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/reshape_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/reshape_infer.c index 4361872c8a..db1ec1fa58 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/reshape_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/reshape_infer.c @@ -142,7 +142,7 @@ int ReshapeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC TensorC *output = outputs[0]; SetDataTypeFormat(output, input); ReshapeParameter *param = (ReshapeParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/resize_grad_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/resize_grad_infer.c index b9b1254dd2..dd20f74ca2 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/resize_grad_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/resize_grad_infer.c @@ -32,7 +32,7 @@ int ResizeGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso } TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } const TensorC *input_1 = inputs[1]; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/resize_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/resize_infer.c index 4a53d353bd..f1a04dc600 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/resize_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/resize_infer.c @@ -116,17 +116,15 @@ int ResizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * #endif const TensorC *input = inputs[0]; - if (input->shape_size_ != 0 && input->shape_size_ != 4) { - return NNACL_ERR; - } TensorC *output = outputs[0]; - SetDataTypeFormat(output, input); - ResizeParameter *param = (ResizeParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } - + if (input->shape_size_ != 0 && input->shape_size_ != 4) { + return NNACL_ERR; + } + ResizeParameter *param = (ResizeParameter *)parameter; int output_shape[MAX_SHAPE_SIZE] = {0}; size_t output_shape_size = 0; ShapePush(output_shape, &output_shape_size, GetBatch(input)); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/rfft_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/rfft_infer.c index 288c85eefb..e464344fe8 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/rfft_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/rfft_infer.c @@ -30,7 +30,7 @@ int RfftInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o TensorC *output = outputs[0]; output->data_type_ = kNumberTypeComplex64; output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } ShapeSet(output->shape_, &(output->shape_size_), input->shape_, input->shape_size_); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/roi_pooling_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/roi_pooling_infer.c index a4484414d3..bfcece8703 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/roi_pooling_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/roi_pooling_infer.c @@ -30,7 +30,7 @@ int ROIPoolingInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso const TensorC *roi = inputs[1]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/scatter_nd_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/scatter_nd_infer.c index ca980b6215..bf77e673fa 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/scatter_nd_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/scatter_nd_infer.c @@ -34,7 +34,7 @@ int ScatterNdInferShape(const TensorC *const *inputs, size_t inputs_size, Tensor TensorC *output = outputs[0]; SetDataTypeFormat(output, update); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int *shape_data = (int *)(shape->data_); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/select_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/select_infer.c index 8cb3183350..183f580e2e 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/select_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/select_infer.c @@ -28,7 +28,7 @@ int SelectInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * } #endif - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } for (size_t i = 0; i < outputs_size; i++) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/shape_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/shape_infer.c index 551d4a3def..3e2190738e 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/shape_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/shape_infer.c @@ -31,7 +31,7 @@ int ShapeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** out_tensor->data_type_ = kNumberTypeInt32; out_tensor->format_ = in_tensor->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } out_tensor->shape_size_ = 1; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/size_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/size_infer.c index 014a8d7397..81bb8a6ab1 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/size_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/size_infer.c @@ -30,7 +30,7 @@ int SizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o TensorC *out_tensor = outputs[0]; out_tensor->data_type_ = kNumberTypeInt32; out_tensor->format_ = in_tensor->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/slice_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/slice_infer.c index 40a552c048..8ebc2c3a2e 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/slice_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/slice_infer.c @@ -26,7 +26,7 @@ int SliceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/softmax_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/softmax_infer.c index c13dc81888..493655ff4a 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/softmax_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/softmax_infer.c @@ -31,7 +31,7 @@ int SoftMaxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC output->data_type_ = input->data_type_; output->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input->shape_size_ > 5) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c index a9e5fdf2f5..c19082141d 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c @@ -32,7 +32,7 @@ int SpaceToBatchInferShape(const TensorC *const *inputs, size_t inputs_size, Ten } SetDataTypeFormat(outputs[0], input); SpaceToBatchParameter *param = (SpaceToBatchParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input->shape_size_ != 4) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_nd_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_nd_infer.c index 322c67db0f..2092ec6f3c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_nd_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_nd_infer.c @@ -110,7 +110,7 @@ int SpaceToBatchNdInferShape(const TensorC *const *inputs, size_t inputs_size, T } outputs[0]->data_type_ = input->data_type_; outputs[0]->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_depth_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_depth_infer.c index d44fe0cbfd..f8f3baf219 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_depth_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_depth_infer.c @@ -33,7 +33,7 @@ int SpaceToDepthInferShape(const TensorC *const *inputs, size_t inputs_size, Ten } SetDataTypeFormat(outputs[0], input); SpaceToDepthParameter *param = (SpaceToDepthParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input->shape_size_ != 4) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/sparse_to_dense_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/sparse_to_dense_infer.c index 65ec900a99..4b44ec7568 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/sparse_to_dense_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/sparse_to_dense_infer.c @@ -30,7 +30,7 @@ int SparseToDenseInferShape(const TensorC *const *inputs, size_t inputs_size, Te const TensorC *input1 = inputs[1]; const TensorC *input2 = inputs[2]; SetDataTypeFormat(output, input2); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int *input1_data = (int *)(input1->data_); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/splice_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/splice_infer.c index f82beaaae3..90fb184621 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/splice_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/splice_infer.c @@ -29,7 +29,7 @@ int SpliceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * const TensorC *input = inputs[0]; TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/split_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/split_infer.c index aa3dd0fb00..e31e272205 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/split_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/split_infer.c @@ -41,7 +41,7 @@ int SplitInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** size_t num_split_ = param->num_split_ == 0 ? (int)(outputs_size) : param->num_split_; param->num_split_ = num_split_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/split_with_over_lap_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/split_with_over_lap_infer.c index 61c009127d..6f5ce5eb7c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/split_with_over_lap_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/split_with_over_lap_infer.c @@ -25,7 +25,7 @@ int SplitWithOverlapInferShape(const TensorC *const *inputs, size_t inputs_size, return check_ret; } #endif - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } const TensorC *input = inputs[0]; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/squeeze_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/squeeze_infer.c index c8fc6ac18a..c297b1dbd2 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/squeeze_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/squeeze_infer.c @@ -29,7 +29,7 @@ int SqueezeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC const TensorC *input = inputs[0]; SqueezeParameter *param = (SqueezeParameter *)parameter; SetDataTypeFormat(outputs[0], input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int out_shape[MAX_SHAPE_SIZE] = {0}; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/stack_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/stack_infer.c index a5d8303bab..bb02091613 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/stack_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/stack_infer.c @@ -28,7 +28,7 @@ int StackInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** const TensorC *input = inputs[0]; SetDataTypeFormat(outputs[0], input); StackParameter *param = (StackParameter *)parameter; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int32_t output_shape[MAX_SHAPE_SIZE] = {0}; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/strided_slice_grad_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/strided_slice_grad_infer.c index 096e73e5ba..febe8a69fb 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/strided_slice_grad_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/strided_slice_grad_infer.c @@ -37,7 +37,7 @@ int StridedSliceGradInferShape(const TensorC *const *inputs, size_t inputs_size, const TensorC *input = inputs[0]; SetDataTypeFormat(outputs[0], input); - bool inferflag = parameter->infer_flag_; + bool inferflag = InferFlag(inputs, inputs_size); int in_shape_[MAX_SHAPE_SIZE] = {0}; size_t in_shape_size = 0; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/strided_slice_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/strided_slice_infer.c index ee3122b918..23da9655e2 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/strided_slice_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/strided_slice_infer.c @@ -313,7 +313,7 @@ int StridedSliceInferShape(const TensorC *const *inputs, size_t inputs_size, Ten const TensorC *input = inputs[0]; SetDataTypeFormat(outputs[0], inputs[0]); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/switch_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/switch_infer.c index 8672e3f785..1cd92abada 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/switch_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/switch_infer.c @@ -57,9 +57,12 @@ int SwitchInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * memcpy(mirror_tensor, inputs[i + 1], sizeof(TensorC)); outputs[i + outputs_size / 2] = mirror_tensor; } + } + bool infer_flag = InferFlag(inputs, inputs_size); + for (size_t i = 0; i < outputs_size / 2; i++) { *((const TensorC **)inputs + i + 1) = NULL; } - if (!parameter->infer_flag_) { + if (!infer_flag) { return NNACL_INFER_INVALID; } return NNACL_OK; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_fromtensor_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_fromtensor_infer.c index f85875dce3..ce2656b29b 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_fromtensor_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_fromtensor_infer.c @@ -32,7 +32,7 @@ int TensorListFromTensorInferShape(const TensorC *const *inputs, size_t inputs_s output->format_ = Format_NHWC; output->tensors_data_type_ = input0->data_type_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_getitem_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_getitem_infer.c index e0ce890ff6..1acf07a4ee 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_getitem_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_getitem_infer.c @@ -28,14 +28,14 @@ int TensorListGetItemInferShape(const TensorC *const *inputs, size_t inputs_size TensorListC *input0 = (TensorListC *)(inputs[0]); const TensorC *get_index = inputs[1]; + if (get_index->data_ == NULL) { + return NNACL_INFER_INVALID; + } if (GetElementNum(get_index) != 1) { return NNACL_ERR; } TensorC *output = outputs[0]; - if (!parameter->infer_flag_ || input0->element_num_ == 0) { - return NNACL_INFER_INVALID; - } - if (get_index->data_ == NULL) { + if (!InferFlag(inputs, inputs_size) || input0->element_num_ == 0) { return NNACL_INFER_INVALID; } int index = ((int *)(get_index->data_))[0]; @@ -51,7 +51,7 @@ int TensorListGetItemInferShape(const TensorC *const *inputs, size_t inputs_size } output->format_ = input0->tensors_[index].format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_reserve_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_reserve_infer.c index 49efd7fd83..e3ddbf52f1 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_reserve_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_reserve_infer.c @@ -49,12 +49,12 @@ int TensorListReserveInferShape(const TensorC *const *inputs, size_t inputs_size if (num_ele_type != kNumberTypeInt && ele_shape_type != kNumberTypeInt32) { return NNACL_ERR; } - if (GetElementNum(input1) != 1) { - return NNACL_ERR; - } if (input1->data_ == NULL) { return NNACL_INFER_INVALID; } + if (GetElementNum(input1) != 1) { + return NNACL_ERR; + } int num_elements = ((int *)(input1->data_))[0]; ShapeSet(output->element_shape_, &(output->element_shape_size_), ele_shape_ptr, GetElementNum(input0)); output->element_num_ = num_elements; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_setitem_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_setitem_infer.c index 0a32bda4c7..987d616ae3 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_setitem_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_setitem_infer.c @@ -51,7 +51,7 @@ int TensorListSetItemInferShape(const TensorC *const *inputs, size_t inputs_size output0->format_ = input0->format_; output0->tensors_data_type_ = value_tensor->data_type_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_stack_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_stack_infer.c index c64936525a..ffcf783150 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_stack_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tensorlist_stack_infer.c @@ -29,7 +29,7 @@ int TensorListStackInferShape(const TensorC *const *inputs, size_t inputs_size, TensorListC *input0 = (TensorListC *)(inputs[0]); output->data_type_ = input0->tensors_data_type_; output->format_ = input0->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } if (input0->element_num_ == 0) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tile_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tile_infer.c index 181b57d0da..19e20e71bd 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tile_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/tile_infer.c @@ -46,7 +46,7 @@ int TileInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/topk_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/topk_infer.c index 59bc152ae3..1ddb3bcb71 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/topk_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/topk_infer.c @@ -35,7 +35,7 @@ int TopKInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o SetDataTypeFormat(output0, input); output1->data_type_ = kNumberTypeInt32; output1->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } const TensorC *input_k_tensor = inputs[1]; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/transpose_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/transpose_infer.c index baf7353218..83b4d40838 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/transpose_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/transpose_infer.c @@ -42,7 +42,7 @@ int TransposeInferShape(const TensorC *const *inputs, size_t inputs_size, Tensor if (parameter->quant_type_ == QuantType_QUANT_WEIGHT) { output->data_type_ = kNumberTypeFloat32; } - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/uniform_real_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/uniform_real_infer.c index ea6997a14a..3002e428ee 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/uniform_real_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/uniform_real_infer.c @@ -21,7 +21,7 @@ int UniformRealInferShape(const TensorC *const *inputs, size_t inputs_size, Tens OpParameter *parameter) { outputs[0]->data_type_ = kNumberTypeFloat32; outputs[0]->format_ = inputs[0]->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int32_t *input_data = (int32_t *)(inputs[0]->data_); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unique_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unique_infer.c index f6e6cf428f..84b00c71c9 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unique_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unique_infer.c @@ -33,7 +33,7 @@ int UniqueInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * SetDataTypeFormat(output0, input); output1->data_type_ = kNumberTypeInt32; output1->format_ = input->format_; - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } SetShapeTensor(output0, input); diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unsqueeze_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unsqueeze_infer.c index 2ba99f9d38..b2ba0f0968 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unsqueeze_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unsqueeze_infer.c @@ -30,7 +30,7 @@ int UnsqueezeInferShape(const TensorC *const *inputs, size_t inputs_size, Tensor TensorC *output = outputs[0]; SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unstack_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unstack_infer.c index c947be6372..1548417ebe 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unstack_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/unstack_infer.c @@ -36,7 +36,7 @@ int UnstackInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC SetDataTypeFormat(outputs[i], input); } - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } int output_shape[MAX_SHAPE_SIZE] = {0}; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/where_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/where_infer.c index b76f303190..09d8e8662f 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/where_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/where_infer.c @@ -41,7 +41,7 @@ int WhereInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** } SetDataTypeFormat(output, input); - if (!parameter->infer_flag_) { + if (!InferFlag(inputs, inputs_size)) { return NNACL_INFER_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/op_base.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/op_base.h index 474125c7f7..51da043bb5 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/op_base.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/op_base.h @@ -81,7 +81,6 @@ typedef enum DataOrder { typedef struct OpParameter { char name_[100]; - bool infer_flag_; int type_; int thread_num_; int quant_type_; diff --git a/mindspore/lite/micro/coder/opcoders/serializers/nnacl_serializer/nnacl_stream_utils.cc b/mindspore/lite/micro/coder/opcoders/serializers/nnacl_serializer/nnacl_stream_utils.cc index 65a0d37608..eba93d0b79 100644 --- a/mindspore/lite/micro/coder/opcoders/serializers/nnacl_serializer/nnacl_stream_utils.cc +++ b/mindspore/lite/micro/coder/opcoders/serializers/nnacl_serializer/nnacl_stream_utils.cc @@ -33,8 +33,7 @@ std::ostream &operator<<(std::ostream &code, const ::QuantArg &quant_arg) { std::ostream &operator<<(std::ostream &code, const OpParameter ¶meter) { code << "{ \"\"" - << ", " << std::boolalpha << parameter.infer_flag_ << ", " << parameter.type_ << ", " << gThreadNum << ", " - << parameter.quant_type_ << "}"; + << ", " << parameter.type_ << ", " << gThreadNum << ", " << parameter.quant_type_ << "}"; return code; } diff --git a/mindspore/lite/micro/coder/session.cc b/mindspore/lite/micro/coder/session.cc index 5db61e48bd..82047b8b73 100644 --- a/mindspore/lite/micro/coder/session.cc +++ b/mindspore/lite/micro/coder/session.cc @@ -209,12 +209,10 @@ OpParameter *CoderSession::GenParameterAndInfer(const Model::Node *node, const s MS_CHECK_PTR_RET_NULL(parame_gen); auto parameter = parame_gen(primitive); MS_CHECK_PTR_RET_NULL(parameter); - parameter->infer_flag_ = true; auto ret = KernelInferShape(inputs, outputs, parameter); if (ret == RET_INFER_INVALID) { MS_LOG(INFO) << "InferShape shouldn't be done before runtime, name: " << node->name_ << ", type: " << PrimitiveTypeName(GetPrimitiveType(primitive)) << "flag set to false."; - parameter->infer_flag_ = false; } else if (ret != RET_OK) { MS_LOG(ERROR) << "InferShape failed, name: " << node->name_ << ", type: " << PrimitiveTypeName(GetPrimitiveType(primitive)); diff --git a/mindspore/lite/src/common/tensor_util.cc b/mindspore/lite/src/common/tensor_util.cc index 6714e3ad56..403a24f13b 100644 --- a/mindspore/lite/src/common/tensor_util.cc +++ b/mindspore/lite/src/common/tensor_util.cc @@ -108,6 +108,7 @@ int TensorList2TensorListC(TensorList *src, TensorListC *dst) { dst->is_ready_ = src->IsReady(); dst->data_type_ = static_cast(src->data_type()); dst->format_ = src->format(); + dst->shape_value_ = src->shape().empty() ? 0 : src->shape().front(); dst->element_num_ = src->shape().empty() ? 0 : src->tensors().size(); dst->tensors_ = reinterpret_cast(malloc(dst->element_num_ * sizeof(TensorC))); diff --git a/mindspore/lite/src/lite_kernel.cc b/mindspore/lite/src/lite_kernel.cc index 51a123e852..5e40715f5d 100644 --- a/mindspore/lite/src/lite_kernel.cc +++ b/mindspore/lite/src/lite_kernel.cc @@ -88,10 +88,8 @@ int LiteKernel::FreeInWorkTensor() const { int LiteKernel::PreProcess() { if (!InferShapeDone()) { - op_parameter_->infer_flag_ = true; auto ret = lite::KernelInferShape(in_tensors_, &out_tensors_, op_parameter_); if (ret != 0) { - op_parameter_->infer_flag_ = false; MS_LOG(ERROR) << "InferShape fail!"; return ret; } diff --git a/mindspore/lite/src/lite_kernel.h b/mindspore/lite/src/lite_kernel.h index 12212a0389..92ade42615 100644 --- a/mindspore/lite/src/lite_kernel.h +++ b/mindspore/lite/src/lite_kernel.h @@ -188,14 +188,15 @@ class LiteKernel { int DecOutTensorRefCount(); #endif - protected: - bool InferShapeDone() { - if (op_parameter_ != nullptr) { - return op_parameter_->infer_flag_; + bool InferShapeDone() const { + auto shape = out_tensors_.front()->shape(); + if (std::find(shape.begin(), shape.end(), -1) != shape.end()) { + return false; } - return false; + return true; } + protected: KernelKey desc_{}; std::string name_; OpParameter *op_parameter_ = nullptr; diff --git a/mindspore/lite/src/lite_session.cc b/mindspore/lite/src/lite_session.cc index 1b0d88d5f0..099092c023 100644 --- a/mindspore/lite/src/lite_session.cc +++ b/mindspore/lite/src/lite_session.cc @@ -690,7 +690,6 @@ void LiteSession::ResetInputsShape(const std::vector> &dims) { } int LiteSession::ReSizeKernels(const std::vector &kernels) { - bool infer_shape_interrupt = false; for (auto kernel : kernels) { if (kernel == nullptr) { MS_LOG(ERROR) << "input kernel is nullptr!"; @@ -708,11 +707,10 @@ int LiteSession::ReSizeKernels(const std::vector &kernels) #endif } else { auto sub_graph = reinterpret_cast(kernel); - ret = sub_graph->ReSize(infer_shape_interrupt); + ret = sub_graph->ReSize(); } if (ret == RET_INFER_INVALID) { MS_LOG(INFO) << "InferShape is interrupted"; - infer_shape_interrupt = true; continue; } if (ret != RET_OK) { diff --git a/mindspore/lite/src/runtime/infer_manager.cc b/mindspore/lite/src/runtime/infer_manager.cc index 42fe69d88c..12a7783872 100644 --- a/mindspore/lite/src/runtime/infer_manager.cc +++ b/mindspore/lite/src/runtime/infer_manager.cc @@ -66,6 +66,9 @@ int KernelInferShape(const std::vector &inputs, std::vectorat(i)); } + if (ret == NNACL_INFER_INVALID) { + outputs->at(i)->set_shape({-1}); + } } FreeAllTensorC(&in_tensors); diff --git a/mindspore/lite/src/runtime/kernel/arm/base/group_convolution_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/group_convolution_base.cc index 7e4081568c..ceb7b5b6b8 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/group_convolution_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/group_convolution_base.cc @@ -75,11 +75,8 @@ void GroupConvolutionBaseCPUKernel::FreeSubKernel() { int GroupConvolutionBaseCPUKernel::PreProcess() { if (!InferShapeDone()) { - op_parameter_->infer_flag_ = true; - auto ret = lite::KernelInferShape(in_tensors_, &out_tensors_, op_parameter_); if (ret != 0) { - op_parameter_->infer_flag_ = false; MS_LOG(ERROR) << "InferShape fail!"; return ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/base/group_convolution_creator.h b/mindspore/lite/src/runtime/kernel/arm/base/group_convolution_creator.h index 2849bf4a7f..723f885ada 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/group_convolution_creator.h +++ b/mindspore/lite/src/runtime/kernel/arm/base/group_convolution_creator.h @@ -37,9 +37,10 @@ class GroupConvCreator { const lite::InnerContext *ctx, bool is_quant, TypeId data_type) : origin_inputs_(std::move(inputs)), origin_outputs_(std::move(outputs)), - infered_(op_parameter->infer_flag_), is_quant_(is_quant), data_type_(data_type) { + auto shape = origin_outputs_.front()->shape(); + infered_ = std::find(shape.begin(), shape.end(), -1) == shape.end(); conv_param_ = reinterpret_cast(op_parameter); } diff --git a/mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc index 4a04f10310..15aee86c78 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc @@ -108,7 +108,7 @@ int ResizeBaseCPUKernel::Init() { auto input = in_tensors_.at(0); auto input_shape = input->shape(); - if (!input_shape.empty() && input_shape.size() != COMM_SHAPE_SIZE) { + if (InferShapeDone() && input_shape.size() != COMM_SHAPE_SIZE) { MS_LOG(ERROR) << "Resize op support input rank 4, got " << input_shape.size(); return RET_ERROR; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/gather_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/gather_fp16.cc index c7699d1559..25dfb29c78 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/gather_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/gather_fp16.cc @@ -56,10 +56,8 @@ int GatherFp16CPUKernel::ReSize() { return RET_OK; } int GatherFp16CPUKernel::PreProcess() { if (!InferShapeDone()) { - op_parameter_->infer_flag_ = true; auto ret = lite::KernelInferShape(in_tensors_, &out_tensors_, op_parameter_); if (ret != 0) { - op_parameter_->infer_flag_ = false; MS_LOG(ERROR) << "InferShape fail!"; return ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_delegate_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_delegate_fp32.cc index 711ee9010b..d81c869ab8 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_delegate_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_delegate_fp32.cc @@ -174,7 +174,8 @@ kernel::LiteKernel *CpuConvDwFp32KernelCreator(const std::vector } auto conv_param = reinterpret_cast(opParameter); kernel::LiteKernel *kernel = nullptr; - if (opParameter->infer_flag_) { + auto shape = outputs.front()->shape(); + if (std::find(shape.begin(), shape.end(), -1) == shape.end()) { #if defined(ENABLE_ARM) || (defined(ENABLE_SSE) && !defined(ENABLE_AVX)) if (CheckConvDw1DWinograd(conv_param, ctx->thread_num_)) { kernel = new (std::nothrow) kernel::ConvolutionDepthwise3x3CPUKernel(opParameter, inputs, outputs, ctx); diff --git a/mindspore/lite/src/runtime/kernel/npu/npu_kernel.h b/mindspore/lite/src/runtime/kernel/npu/npu_kernel.h index 2b08de0ea4..22a775ccbf 100644 --- a/mindspore/lite/src/runtime/kernel/npu/npu_kernel.h +++ b/mindspore/lite/src/runtime/kernel/npu/npu_kernel.h @@ -61,7 +61,8 @@ template kernel::LiteKernel *NPUKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, const lite::Context *ctx, const kernel::KernelKey &desc) { - if (!op_parameter->infer_flag_) { + auto shape = outputs.front()->shape(); + if (std::find(shape.begin(), shape.end(), -1) != shape.end()) { MS_LOG(ERROR) << "NPU does not support runtime inference shape. Type is:" << schema::EnumNamePrimitiveType(static_cast(op_parameter->type_)); free(op_parameter); diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d.cc index 274767d269..db3ba521ea 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d.cc @@ -405,7 +405,7 @@ std::vector Conv2DOpenCLKernel::GenerateTuningParam() { } int Conv2DOpenCLKernel::StoreConstData() { - if (!op_parameter_->infer_flag_) { + if (!InferShapeDone()) { stored_filter_ = StoreTensorData(in_tensors_.at(kWeightIndex)); if (stored_filter_ == nullptr) { MS_LOG(ERROR) << "Store weight failed."; @@ -445,7 +445,6 @@ OpParameter *CreateFcParam(const ConvParameter *conv_param, const std::vector
  • op_parameter_.type_ = PrimitiveType_FullConnection; - fc_param->op_parameter_.infer_flag_ = true; fc_param->a_transpose_ = false; fc_param->b_transpose_ = true; fc_param->act_type_ = conv_param->act_type_; @@ -517,7 +516,8 @@ kernel::LiteKernel *OpenCLConv2DCreator(const std::vector &input // case 3: common conv2d kernel::OpenCLKernel *kernel = nullptr; - bool infer_shape_done = opParameter->infer_flag_; + auto shape = outputs.front()->shape(); + bool infer_shape_done = std::find(shape.begin(), shape.end(), -1) == shape.end(); if (infer_shape_done && UseFcReplaceConv(inputs, outputs, conv_param)) { auto *fc_param = CreateFcParam(conv_param, inputs); kernel = new (std::nothrow) diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d_transpose.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d_transpose.cc index a4acdc1d9a..1e8dbb084e 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d_transpose.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d_transpose.cc @@ -247,7 +247,7 @@ int Conv2dTransposeOpenCLKernel::InferShape() { } int Conv2dTransposeOpenCLKernel::StoreConstData() { - if (!op_parameter_->infer_flag_) { + if (!InferShapeDone()) { stored_weight_ = StoreTensorData(in_tensors_.at(kWeightIndex)); if (stored_weight_ == nullptr) { MS_LOG(ERROR) << "Store weight failed."; diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/depthwise_conv2d.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/depthwise_conv2d.cc index d1ba226817..2b9babf638 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/depthwise_conv2d.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/depthwise_conv2d.cc @@ -254,7 +254,7 @@ void DepthwiseConv2dOpenCLKernel::SetGlobalLocal() { } int DepthwiseConv2dOpenCLKernel::StoreConstData() { - if (!op_parameter_->infer_flag_) { + if (!InferShapeDone()) { stored_weight_ = StoreTensorData(in_tensors_.at(kWeightIndex)); if (stored_weight_ == nullptr) { MS_LOG(ERROR) << "Store weight failed."; diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/fullconnection.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/fullconnection.cc index 1313f0f55b..ce71e81ff9 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/fullconnection.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/fullconnection.cc @@ -249,7 +249,7 @@ void FullConnectionOpenCLKernel::SetConstArgs() { } int FullConnectionOpenCLKernel::StoreConstData() { - if (!op_parameter_->infer_flag_) { + if (!InferShapeDone()) { stored_weight_ = StoreTensorData(in_tensors_.at(kWeightIndex)); if (stored_weight_ == nullptr) { MS_LOG(ERROR) << "Store weight failed."; diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/gather.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/gather.cc index 0bb1908677..d8ae061c58 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/gather.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/gather.cc @@ -190,7 +190,7 @@ int GatherOpenCLKernel::InitWeights() { } int GatherOpenCLKernel::PreProcess() { - if (!op_parameter_->infer_flag_) { + if (!InferShapeDone()) { auto indices_tensor = in_tensors_[1]; if (!indices_tensor->IsConst()) { ocl_runtime_->SyncCommandQueue(); diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/matmul.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/matmul.cc index 7e25a3975e..17d69ee63f 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/matmul.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/matmul.cc @@ -117,16 +117,16 @@ int MatMulOpenCLKernel::InitWeights() { auto param = reinterpret_cast(op_parameter_); transposeB = param->b_transpose_; enable_fp16_ = ocl_runtime_->GetFp16Enable(); - int ci, co; + int ci; if (transposeB) { ci = weight_shape_4d[3]; - co = weight_shape_4d[2]; + CO_ = weight_shape_4d[2]; } else { ci = weight_shape_4d[2]; - co = weight_shape_4d[3]; + CO_ = weight_shape_4d[3]; } int ci4 = UP_DIV(ci, C4NUM); - int co4 = UP_DIV(co, C4NUM); + int co4 = UP_DIV(CO_, C4NUM); int a = weight_shape_4d[0]; int b = weight_shape_4d[1]; @@ -146,15 +146,15 @@ int MatMulOpenCLKernel::InitWeights() { int index = 0; for (int aa = 0; aa < a; aa++) { for (int bb = 0; bb < b; bb++) { - int baseAB = (aa * b + bb) * ci * co; + int baseAB = (aa * b + bb) * ci * CO_; for (int i = 0; i < ci4; ++i) { for (int j = 0; j < co4; ++j) { for (int k = 0; k < C4NUM; ++k) { for (int l = 0; l < C4NUM; ++l) { int src_ci = i * C4NUM + l; int src_co = j * C4NUM + k; - if (src_ci < ci && src_co < co) { - int originId = baseAB + src_ci * co + src_co; + if (src_ci < ci && src_co < CO_) { + int originId = baseAB + src_ci * CO_ + src_co; if (transposeB) { originId = baseAB + src_co * ci + src_ci; } @@ -188,7 +188,6 @@ int MatMulOpenCLKernel::InitWeights() { int MatMulOpenCLKernel::InitBias() { // pad FC Bias - CO_ = GpuTensorInfo(out_tensors_[0]).C; auto allocator = ocl_runtime_->GetAllocator(); int co4 = UP_DIV(CO_, C4NUM); size_t dtype_size = enable_fp16_ ? sizeof(uint16_t) : sizeof(float); @@ -259,7 +258,7 @@ int MatMulOpenCLKernel::Run() { } int MatMulOpenCLKernel::StoreConstData() { - if (!op_parameter_->infer_flag_) { + if (!InferShapeDone()) { stored_weight_ = StoreTensorData(in_tensors_.at(kWeightIndex)); if (stored_weight_ == nullptr) { MS_LOG(ERROR) << "Store weight failed."; @@ -280,7 +279,8 @@ kernel::LiteKernel *OpenCLMatMulKernelCreator(const std::vector const std::vector &outputs, OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { kernel::OpenCLKernel *kernel = nullptr; - bool infer_shape_done = opParameter->infer_flag_; + auto shape = outputs.front()->shape(); + bool infer_shape_done = std::find(shape.begin(), shape.end(), -1) == shape.end(); if (infer_shape_done && IsUseStrassenMatmul(inputs)) { MS_LOG(DEBUG) << "use_matmul_strassen"; kernel = new (std::nothrow) diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/reshape.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/reshape.cc index b4214741b0..4b99070fb5 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/reshape.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/reshape.cc @@ -98,7 +98,7 @@ int ReshapeOpenCLKernel::Run() { } int ReshapeOpenCLKernel::PreProcess() { - if (Type() == PrimitiveType_Reshape && !op_parameter_->infer_flag_) { + if (Type() == PrimitiveType_Reshape && !InferShapeDone()) { auto shape_tensor = in_tensors_[1]; if (!shape_tensor->IsConst()) { ocl_runtime_->SyncCommandQueue(); diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/resize.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/resize.cc index de6514c544..fa5385cbdc 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/resize.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/resize.cc @@ -121,7 +121,7 @@ int ResizeOpenCLKernel::Run() { } int ResizeOpenCLKernel::PreProcess() { - if (Type() == PrimitiveType_Resize && !op_parameter_->infer_flag_ && in_tensors_.size() == 2) { + if (Type() == PrimitiveType_Resize && !InferShapeDone() && in_tensors_.size() == 2) { auto shape_tensor = in_tensors_[1]; if (!shape_tensor->IsConst()) { ocl_runtime_->SyncCommandQueue(); diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/to_format.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/to_format.cc index 1ae4303451..7d85f43174 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/to_format.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/to_format.cc @@ -101,8 +101,7 @@ int ToFormatOpenCLKernel::Run() { } int ToFormatOpenCLKernel::InferShape() { - if (!op_parameter_->infer_flag_) { - op_parameter_->infer_flag_ = true; + if (!InferShapeDone()) { out_tensors_.front()->set_shape(in_tensors_.front()->shape()); } return RET_OK; diff --git a/mindspore/lite/src/runtime/kernel/opencl/opencl_fusion.cc b/mindspore/lite/src/runtime/kernel/opencl/opencl_fusion.cc index 8b67e29d60..128ee74dfe 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/opencl_fusion.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/opencl_fusion.cc @@ -135,7 +135,6 @@ std::vector RemoveDuplicationsButKeepOrder(const std::vector &vec) { void Merge(LiteKernel *a, LiteKernel *b, bool remove_a) { MS_ASSERT(a); MS_ASSERT(b); - MS_ASSERT(b->op_parameter()->infer_flag_); if (remove_a) { // pred->tensor0->a->tensor1->b: remove a tensor1 // update pred out_kernels: a.in_kernels.out_kernels.replace(a,b) for (auto *pred : a->in_kernels()) { @@ -232,7 +231,7 @@ void TryMergePadXxx(LiteKernel *node, std::set *removed_set, std:: } LiteKernel *pad = node->in_kernels().front(); MS_ASSERT(pad); - if (!pad->op_parameter()->infer_flag_) { + if (!pad->InferShapeDone()) { return; } if (pad->in_tensors().front()->shape().size() != 4) { @@ -268,8 +267,7 @@ void TryMergeConvReshape(LiteKernel *reshape, std::set *removed_se // group must be 1 LiteKernel *conv = reshape->in_kernels().front(); MS_ASSERT(conv); - - if (!conv->op_parameter()->infer_flag_) { + if (!conv->InferShapeDone()) { return; } auto *param = reinterpret_cast(reinterpret_cast(conv)->GetParameter()); @@ -294,10 +292,10 @@ void TryMergeFcReshape(LiteKernel *reshape, std::set *removed_set, bool NC_N11C_flag = NC_N11C(reshape); if (NC_N11C_flag || N11C_NC(reshape)) { LiteKernel *fc = reshape->in_kernels().front(); - if (!fc->op_parameter()->infer_flag_) { + MS_ASSERT(fc); + if (!fc->InferShapeDone()) { return; } - MS_ASSERT(fc); MergeRemoveB(fc, reshape, removed_set); MS_LOG(DEBUG) << "Merge FullConnection and Reshape" + (NC_N11C_flag ? std::string("(NC->N11C)") : "(N11C->NC)") + " success"; @@ -314,7 +312,7 @@ void TryMergeReshapeFc(LiteKernel *fc, std::set *removed_set, std: } LiteKernel *reshape = fc->in_kernels().front(); MS_ASSERT(reshape); - if (!reshape->op_parameter()->infer_flag_) { + if (!reshape->InferShapeDone()) { return; } bool NC11_NC_flag = NC11_NC(reshape); @@ -331,7 +329,7 @@ void TryMergeArithmeticAct(LiteKernel *act, std::set *removed_set) MS_ASSERT(removed_set); LiteKernel *arithmetic = act->in_kernels().front(); MS_ASSERT(arithmetic); - if (!arithmetic->op_parameter()->infer_flag_) { + if (!arithmetic->InferShapeDone()) { return; } auto *arithmetic_param = @@ -357,7 +355,7 @@ void TryMergeXxxActivation(LiteKernel *act, std::set *removed_set) auto *act_param = reinterpret_cast(reinterpret_cast(act)->GetParameter()); LiteKernel *node = act->in_kernels().front(); MS_ASSERT(node); - if (!node->op_parameter()->infer_flag_) { + if (!node->InferShapeDone()) { return; } auto *param = reinterpret_cast(reinterpret_cast(node)->GetParameter()); @@ -400,7 +398,7 @@ void TryMergeConvPReLU(LiteKernel *prelu, std::set *removed_set, s } LiteKernel *conv = prelu->in_kernels().front(); MS_ASSERT(conv); - if (!conv->op_parameter()->infer_flag_) { + if (!conv->InferShapeDone()) { return; } if (reinterpret_cast(conv)->use_winograd_) { @@ -499,7 +497,7 @@ void TryMergeDeconvScale(LiteKernel *scale, std::set *removed_set, } LiteKernel *deconv = scale->in_kernels().front(); MS_ASSERT(deconv); - if (!deconv->op_parameter()->infer_flag_) { + if (!deconv->InferShapeDone()) { return; } @@ -573,7 +571,7 @@ void CreateEltwiseKernelReplaceOld(FusionEltwiseParameter *param, LiteKernel *ol // Eltwise + Eltwise int TryMergeEltwiseEltwise(LiteKernel *node, std::set *removed_set, std::vector *nodes) { - if (!node->op_parameter()->infer_flag_) { + if (!node->InferShapeDone()) { return RET_ERROR; } MS_ASSERT(node); @@ -590,7 +588,7 @@ int TryMergeEltwiseEltwise(LiteKernel *node, std::set *removed_set std::map pred_params; for (LiteKernel *pred : preds) { MS_ASSERT(pred); - if (!pred->op_parameter()->infer_flag_) { + if (!pred->InferShapeDone()) { continue; } if (AIsInB(pred, nodes) && IsEltwiseAndOperatorSupported(pred) && pred->out_kernels().size() == 1) { @@ -622,7 +620,7 @@ int TryMergeEltwiseEltwise(LiteKernel *node, std::set *removed_set } void DoSpecificFusion(LiteKernel *node, std::set *removed_set, std::vector *nodes) { - if (!node->op_parameter()->infer_flag_) { + if (!node->InferShapeDone()) { return; } switch (node->Type()) { diff --git a/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc b/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc index 1d512474ca..4c6baa306d 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.cc @@ -194,22 +194,20 @@ int OpenCLKernel::PostProcess() { } int OpenCLKernel::InferShape() { - if (op_parameter_->infer_flag_) { + if (InferShapeDone()) { return RET_OK; } - op_parameter_->infer_flag_ = true; auto ret = lite::KernelInferShape(in_tensors_, &out_tensors_, op_parameter_); if (ret != RET_OK) { MS_LOG(ERROR) << "InferShape failed, type: " << schema::EnumNamePrimitiveType(static_cast(Type())); - op_parameter_->infer_flag_ = false; return ret; } return RET_OK; } int OpenCLKernel::ReSize() { - if (op_parameter_->infer_flag_) { + if (InferShapeDone()) { return RET_OK; } auto ret = InferShape(); diff --git a/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h b/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h index 13afc3433d..49095583c3 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h +++ b/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h @@ -244,7 +244,8 @@ kernel::LiteKernel *OpenCLKernelCreator(const std::vector &input free(opParameter); return nullptr; } - if (!opParameter->infer_flag_) { + auto shape = outputs.front()->shape(); + if (std::find(shape.begin(), shape.end(), -1) != shape.end()) { MS_LOG(WARNING) << "kernel " << opParameter->name_ << "don't infer shape yet!"; return kernel; } diff --git a/mindspore/lite/src/runtime/kernel/opencl/opencl_subgraph.cc b/mindspore/lite/src/runtime/kernel/opencl/opencl_subgraph.cc index 0d9d78b046..86fb31b3d6 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/opencl_subgraph.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/opencl_subgraph.cc @@ -100,11 +100,6 @@ void OpenCLSubGraph::ReplaceOutTensorAndKernelToConvert(const lite::Tensor *in_t iv->set_out_tensors(tensors); in_convert_op->AddInKernel(iv); } - if (in_convert_op->in_kernels().empty()) { - in_convert_op->op_parameter()->infer_flag_ = true; - } else { - in_convert_op->op_parameter()->infer_flag_ = in_opencl_op->in_kernels().front()->op_parameter()->infer_flag_; - } } } @@ -148,7 +143,6 @@ int OpenCLSubGraph::GenToFormatOp(const std::vector &in_tensors, return RET_ERROR; } parameter->op_parameter.type_ = PRIM_TO_FORMAT; - parameter->op_parameter.infer_flag_ = false; // infer_flag_ is set in ReplaceOutTensorAndKernelToConvert() parameter->out_mem_type = mem_type; out_parameters->emplace_back(parameter); LiteKernel *in_convert_op = nullptr; @@ -343,7 +337,7 @@ int OpenCLSubGraph::Prepare() { return ret; } } - if (opencl_kernel->op_parameter()->infer_flag_) { + if (opencl_kernel->InferShapeDone()) { auto ret = node->Prepare(); if (ret != RET_OK) { MS_LOG(ERROR) << "prepare node " << node->name() << " failed"; @@ -389,17 +383,15 @@ int OpenCLSubGraph::ReSize(bool interrupt) { MS_LOG(ERROR) << "input kernel is nullptr!"; return RET_ERROR; } - auto opencl_kernel = reinterpret_cast(kernel); if (kernel->subgraph_type() != kernel::kNotSubGraph) { MS_LOG(ERROR) << "all nodes in should be kernel"; return RET_ERROR; } - std::vector inputs = kernel->in_tensors(); std::vector outputs = kernel->out_tensors(); for (auto &output : outputs) { output->FreeData(); + output->set_shape({-1}); } - opencl_kernel->op_parameter()->infer_flag_ = false; } for (auto kernel : nodes_) { auto opencl_kernel = reinterpret_cast(kernel); diff --git a/mindspore/lite/src/runtime/kernel/opencl/opencl_subgraph.h b/mindspore/lite/src/runtime/kernel/opencl/opencl_subgraph.h index 38ba38d364..18491ca8fb 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/opencl_subgraph.h +++ b/mindspore/lite/src/runtime/kernel/opencl/opencl_subgraph.h @@ -38,7 +38,7 @@ class OpenCLSubGraph : public SubGraphKernel { this->name_ = "GpuSubGraph"; nodes_set_.insert(nodes.begin(), nodes.end()); all_kernels_infer_done_ = std::all_of(nodes_.begin(), nodes_.end(), [](const kernel::LiteKernel *kernel) { - return kernel && kernel->op_parameter() && kernel->op_parameter()->infer_flag_; + return kernel && kernel->InferShapeDone(); }); } ~OpenCLSubGraph() override; diff --git a/mindspore/lite/src/scheduler.cc b/mindspore/lite/src/scheduler.cc index e26fea4486..7f7b624d84 100644 --- a/mindspore/lite/src/scheduler.cc +++ b/mindspore/lite/src/scheduler.cc @@ -74,8 +74,7 @@ int Scheduler::Schedule(std::vector *dst_kernels) { search_sub_graph.SubGraphSplitByOutput(); #endif - bool infer_shape_interrupt = false; - auto ret = InferSubGraphShape(kMainSubGraphIndex, &infer_shape_interrupt); + auto ret = InferSubGraphShape(kMainSubGraphIndex); if (ret != RET_OK) { MS_LOG(ERROR) << "op infer shape failed."; return ret; @@ -121,24 +120,16 @@ void Scheduler::FindNodeInoutTensors(const lite::Model::Node &node, std::vector< } } -int Scheduler::InferNodeShape(const lite::Model::Node *node, bool *infer_shape_interrupt) { +int Scheduler::InferNodeShape(const lite::Model::Node *node) { MS_ASSERT(node != nullptr); - MS_ASSERT(infer_shape_interrupt != nullptr); auto primitive = node->primitive_; MS_ASSERT(primitive != nullptr); if (IsPartialNode(primitive)) { - return InferPartialShape(node, infer_shape_interrupt); + return InferPartialShape(node); } std::vector inputs; std::vector outputs; FindNodeInoutTensors(*node, &inputs, &outputs); - bool infer_valid = std::all_of(inputs.begin(), inputs.end(), [](const Tensor *tensor) { - auto shape = tensor->shape(); - return std::all_of(shape.begin(), shape.end(), [](const int dim) { return dim != -1; }); - }); - if (!infer_valid) { - *infer_shape_interrupt = true; - } int schema_version = VersionManager::GetInstance()->GetSchemaVersion(); auto parame_gen = PopulateRegistry::GetInstance()->GetParameterCreator(GetPrimitiveType(node->primitive_), schema_version); @@ -154,12 +145,7 @@ int Scheduler::InferNodeShape(const lite::Model::Node *node, bool *infer_shape_i parameter->quant_type_ = node->quant_type_; op_parameters_[node->output_indices_.at(0)] = parameter; - parameter->infer_flag_ = !(*infer_shape_interrupt); auto ret = KernelInferShape(inputs, &outputs, parameter); - if (ret == RET_INFER_INVALID) { - parameter->infer_flag_ = false; - *infer_shape_interrupt = true; - } if (ret == RET_OK) { for (auto &output : outputs) { if (output->ElementsNum() >= MAX_MALLOC_SIZE / static_cast(sizeof(int64_t))) { @@ -171,19 +157,17 @@ int Scheduler::InferNodeShape(const lite::Model::Node *node, bool *infer_shape_i return ret; } -int Scheduler::InferPartialShape(const lite::Model::Node *node, bool *infer_shape_interrupt) { +int Scheduler::InferPartialShape(const lite::Model::Node *node) { MS_ASSERT(src_model_ != nullptr); MS_ASSERT(node != nullptr); - MS_ASSERT(infer_shape_interrupt != nullptr); if (!IsPartialNode(node->primitive_)) { MS_LOG(ERROR) << "Node is not a partial"; return RET_PARAM_INVALID; } - return InferSubGraphShape(GetPartialGraphIndex(node->primitive_), infer_shape_interrupt); + return InferSubGraphShape(GetPartialGraphIndex(node->primitive_)); } -int Scheduler::InferSubGraphShape(size_t subgraph_index, bool *infer_shape_interrupt) { - MS_ASSERT(infer_shape_interrupt != nullptr); +int Scheduler::InferSubGraphShape(size_t subgraph_index) { MS_ASSERT(src_model_ != nullptr); MS_ASSERT(!src_model_->sub_graphs_.empty()); MS_ASSERT(src_model_->sub_graphs_.size() > subgraph_index); @@ -197,11 +181,10 @@ int Scheduler::InferSubGraphShape(size_t subgraph_index, bool *infer_shape_inter return RET_ERROR; } auto type = GetPrimitiveType(primitive); - auto ret = InferNodeShape(node, infer_shape_interrupt); + auto ret = InferNodeShape(node); if (ret == RET_INFER_INVALID) { MS_LOG(INFO) << "InferShape interrupted, name: " << node->name_ << ", type: " << PrimitiveTypeName(type) << ", set infer flag to false."; - *infer_shape_interrupt = true; } else if (ret != RET_OK) { MS_LOG(ERROR) << "InferShape failed, name: " << node->name_ << ", type: " << PrimitiveTypeName(type); return RET_INFER_ERR; @@ -461,7 +444,6 @@ kernel::LiteKernel *Scheduler::FindBackendKernel(const std::vector &in MS_LOG(ERROR) << "Can not find OpParameter!type: " << PrimitiveTypeName(GetPrimitiveType(node->primitive_)); return nullptr; } - bool infer_shape_interrupt = !op_parameter->infer_flag_; kernel::KernelKey desc{kCPU, data_type, static_cast(op_parameter->type_)}; kernel::LiteKernel *kernel = nullptr; int status; @@ -474,7 +456,7 @@ kernel::LiteKernel *Scheduler::FindBackendKernel(const std::vector &in MS_LOG(DEBUG) << "Get gpu op failed, scheduler to cpu: " << PrimitiveCurVersionTypeName(desc.type) << " " << node->name_; if (status == RET_ERROR) { - auto ret = InferNodeShape(node, &infer_shape_interrupt); + auto ret = InferNodeShape(node); if (ret == RET_INFER_INVALID || ret == RET_OK) { op_parameter = op_parameters_[node->output_indices_.at(0)]; } else { @@ -494,7 +476,7 @@ kernel::LiteKernel *Scheduler::FindBackendKernel(const std::vector &in MS_LOG(DEBUG) << "Get npu op failed, scheduler to cpu: " << PrimitiveCurVersionTypeName(desc.type) << " " << node->name_; if (status == RET_ERROR) { - auto ret = InferNodeShape(node, &infer_shape_interrupt); + auto ret = InferNodeShape(node); if (ret == RET_INFER_INVALID || ret == RET_OK) { op_parameter = op_parameters_[node->output_indices_.at(0)]; } else { @@ -513,7 +495,7 @@ kernel::LiteKernel *Scheduler::FindBackendKernel(const std::vector &in MS_LOG(DEBUG) << "Get fp16 op failed, scheduler to cpu: " << PrimitiveCurVersionTypeName(desc.type) << " " << node->name_; if (status == RET_ERROR) { - auto ret = InferNodeShape(node, &infer_shape_interrupt); + auto ret = InferNodeShape(node); if (ret == RET_INFER_INVALID || ret == RET_OK) { op_parameter = op_parameters_[node->output_indices_.at(0)]; } else { @@ -532,7 +514,7 @@ kernel::LiteKernel *Scheduler::FindBackendKernel(const std::vector &in if (status == RET_OK) { return kernel; } else if (status == RET_ERROR) { - auto ret = InferNodeShape(node, &infer_shape_interrupt); + auto ret = InferNodeShape(node); if (!(ret == RET_INFER_INVALID || ret == RET_OK)) { MS_LOG(ERROR) << "Try repeat infer fail: " << node->name_; } diff --git a/mindspore/lite/src/scheduler.h b/mindspore/lite/src/scheduler.h index 67fe1c6159..e2e927128f 100644 --- a/mindspore/lite/src/scheduler.h +++ b/mindspore/lite/src/scheduler.h @@ -50,11 +50,11 @@ class Scheduler { void FindNodeInoutTensors(const lite::Model::Node &node, std::vector *inputs, std::vector *outputs); // infer shape for a partial node - int InferPartialShape(const lite::Model::Node *node, bool *infer_shape_interrupt); + int InferPartialShape(const lite::Model::Node *node); // infer shape for a node - int InferNodeShape(const lite::Model::Node *node, bool *infer_shape_interrupt); + int InferNodeShape(const lite::Model::Node *node); // infer shape for a subgraph - int InferSubGraphShape(size_t subgraph_index, bool *infer_shape_interrupt); + int InferSubGraphShape(size_t subgraph_index); // schedule a node to kernel according to context and kernels registered kernel::LiteKernel *FindBackendKernel(const std::vector &in_tensors, diff --git a/mindspore/lite/src/sub_graph_kernel.cc b/mindspore/lite/src/sub_graph_kernel.cc index 855f5f4fea..0d047ba109 100644 --- a/mindspore/lite/src/sub_graph_kernel.cc +++ b/mindspore/lite/src/sub_graph_kernel.cc @@ -86,9 +86,7 @@ int SubGraphKernel::Run(const KernelCallBack &before, const KernelCallBack &afte return RET_OK; } -int SubGraphKernel::ReSize() { return ReSize(false); } - -int SubGraphKernel::ReSize(bool is_interrupt) { +int SubGraphKernel::ReSize() { for (auto kernel : nodes_) { if (kernel == nullptr) { MS_LOG(ERROR) << "input kernel is nullptr!"; @@ -108,21 +106,18 @@ int SubGraphKernel::ReSize(bool is_interrupt) { for (auto &output : outputs) { output->FreeData(); } - parameter->infer_flag_ = !is_interrupt; auto ret = lite::KernelInferShape(inputs, &outputs, parameter); if (ret == RET_INFER_INVALID) { MS_LOG(INFO) << "InferShape shouldn't be done before runtime, type:" << schema::EnumNamePrimitiveType(static_cast(kernel->Type())) << "flag set to false."; - parameter->infer_flag_ = false; - is_interrupt = true; } else if (ret != RET_OK) { MS_LOG(ERROR) << "InferShape failed, type: " << schema::EnumNamePrimitiveType(static_cast(kernel->Type())); return RET_INFER_ERR; } - if (!is_interrupt) { + if (ret == RET_OK) { ret = kernel->ReSize(); if (ret != RET_OK) { MS_LOG(ERROR) << "kernel " << kernel->name() << " resize fail!ret = " << ret; @@ -130,10 +125,6 @@ int SubGraphKernel::ReSize(bool is_interrupt) { } } } - if (is_interrupt) { - MS_LOG(INFO) << "Infer shape failed."; - return RET_INFER_INVALID; - } return RET_OK; } diff --git a/mindspore/lite/src/sub_graph_kernel.h b/mindspore/lite/src/sub_graph_kernel.h index 65f7720607..3b4b637fe7 100644 --- a/mindspore/lite/src/sub_graph_kernel.h +++ b/mindspore/lite/src/sub_graph_kernel.h @@ -102,8 +102,6 @@ class SubGraphKernel : public LiteKernel { int ReSize() override; - int ReSize(bool is_interrupt); - void InitOutTensorInitRefCount() override; int Init() override { return mindspore::lite::RET_OK; } diff --git a/mindspore/lite/test/models_tf_fp16.cfg b/mindspore/lite/test/models_tf_fp16.cfg index 1709130c7a..3e92474c34 100644 --- a/mindspore/lite/test/models_tf_fp16.cfg +++ b/mindspore/lite/test/models_tf_fp16.cfg @@ -6,7 +6,7 @@ ml_vision_guide_detection1.pb 0.5 ml_vision_guide_detection3.pb 0.5 ml_video_edit_generate_filter.pb 2 -ml_ocr_jk.pb 0.5 +ml_ocr_jk.pb 0.7 # The accumulated error causes the threshold to be exceeded ml_ocr_latin.pb 12 scan_hms_angle.pb 1.5 diff --git a/mindspore/lite/test/ut/nnacl/infer/adam_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/adam_infer_test.cc index 55091d5028..31834b01b4 100644 --- a/mindspore/lite/test/ut/nnacl/infer/adam_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/adam_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(AdamInferTest, AdamInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = AdamInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/addn_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/addn_infer_test.cc index a969b23d02..0604cfa8cf 100644 --- a/mindspore/lite/test/ut/nnacl/infer/addn_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/addn_infer_test.cc @@ -40,7 +40,6 @@ TEST_F(AddnInferTest, AddnInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = AddnInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -74,7 +73,6 @@ TEST_F(AddnInferTest, AddnInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = AddnInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/apply_momentum_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/apply_momentum_infer_test.cc index ea3233958c..5c21e8233c 100644 --- a/mindspore/lite/test/ut/nnacl/infer/apply_momentum_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/apply_momentum_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(ApplyMomentumInferTest, ApplyMomentumInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ApplyMomentumInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/argmax_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/argmax_infer_test.cc index 61714de798..d003c9d27e 100644 --- a/mindspore/lite/test/ut/nnacl/infer/argmax_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/argmax_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(ArgmaxInferTest, ArgmaxInferTest0) { parameter->topk_ = 1; parameter->keep_dims_ = true; parameter->axis_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = ArgMinMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -63,7 +62,6 @@ TEST_F(ArgmaxInferTest, ArgmaxInferTest1) { parameter->topk_ = 1; parameter->keep_dims_ = true; parameter->axis_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = ArgMinMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -92,7 +90,6 @@ TEST_F(ArgmaxInferTest, ArgmaxInferTest2) { parameter->topk_ = 1; parameter->keep_dims_ = true; parameter->axis_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = ArgMinMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -121,7 +118,6 @@ TEST_F(ArgmaxInferTest, ArgmaxInferTestTopK2) { parameter->topk_ = 2; parameter->keep_dims_ = true; parameter->axis_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = ArgMinMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/argmin_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/argmin_infer_test.cc index 62686ba1d4..7fe54cfd97 100644 --- a/mindspore/lite/test/ut/nnacl/infer/argmin_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/argmin_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(ArgminInferTest, ArgminInferTest0) { parameter->topk_ = 1; parameter->keep_dims_ = true; parameter->axis_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = ArgMinMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -63,7 +62,6 @@ TEST_F(ArgminInferTest, ArgminInferTest1) { parameter->topk_ = 1; parameter->keep_dims_ = true; parameter->axis_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = ArgMinMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -92,7 +90,6 @@ TEST_F(ArgminInferTest, ArgminInferTest2) { parameter->topk_ = 1; parameter->keep_dims_ = true; parameter->axis_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = ArgMinMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -121,7 +118,6 @@ TEST_F(ArgminInferTest, ArgminInferTestTopK2) { parameter->topk_ = 2; parameter->keep_dims_ = true; parameter->axis_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = ArgMinMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/arithmetic_compare_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/arithmetic_compare_infer_test.cc index addd8ab093..869edf1d4d 100644 --- a/mindspore/lite/test/ut/nnacl/infer/arithmetic_compare_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/arithmetic_compare_infer_test.cc @@ -42,7 +42,6 @@ TEST_F(ArithmeticCompareInferTest, ArithmeticCompareInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ArithmeticCompareInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_ERR); @@ -74,7 +73,6 @@ TEST_F(ArithmeticCompareInferTest, ArithmeticCompareInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ArithmeticCompareInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); @@ -112,7 +110,6 @@ TEST_F(ArithmeticCompareInferTest, ArithmeticCompareInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ArithmeticCompareInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); @@ -151,7 +148,6 @@ TEST_F(ArithmeticCompareInferTest, ArithmeticCompareInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ArithmeticCompareInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/arithmetic_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/arithmetic_infer_test.cc index d950c79043..146c3f0f80 100644 --- a/mindspore/lite/test/ut/nnacl/infer/arithmetic_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/arithmetic_infer_test.cc @@ -42,7 +42,6 @@ TEST_F(ArithmeticInferTest, ArithmeticInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ArithmeticInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_ERR); @@ -74,7 +73,6 @@ TEST_F(ArithmeticInferTest, ArithmeticInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ArithmeticInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); @@ -112,7 +110,6 @@ TEST_F(ArithmeticInferTest, ArithmeticInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ArithmeticInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); @@ -151,7 +148,6 @@ TEST_F(ArithmeticInferTest, ArithmeticInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ArithmeticInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/assign_add_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/assign_add_infer_test.cc index 5e04900cdc..6f6e823ff0 100644 --- a/mindspore/lite/test/ut/nnacl/infer/assign_add_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/assign_add_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(AssignAddInferTest, AssignAddInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = AssignAddInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/assign_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/assign_infer_test.cc index dbb75e39fc..8263392c02 100644 --- a/mindspore/lite/test/ut/nnacl/infer/assign_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/assign_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(AssignInferTest, AssignInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = AssignInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/audio_spectrogram_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/audio_spectrogram_infer_test.cc index c55b0424a7..5c724ae1ab 100644 --- a/mindspore/lite/test/ut/nnacl/infer/audio_spectrogram_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/audio_spectrogram_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(AudioSpectrogramInferTest, AudioSpectrogramInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; AudioSpectrogramParameter *parameter = new AudioSpectrogramParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->window_size_ = 3; parameter->stride_ = 2; int ret = AudioSpectrogramInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), diff --git a/mindspore/lite/test/ut/nnacl/infer/batch_to_space_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/batch_to_space_infer_test.cc index 6744e59e92..0541102b75 100644 --- a/mindspore/lite/test/ut/nnacl/infer/batch_to_space_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/batch_to_space_infer_test.cc @@ -38,7 +38,6 @@ TEST_F(BatchToSpaceInferTest, BatchToSpaceInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; BatchToSpaceParameter *parameter = new BatchToSpaceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->block_shape_[0] = 2; parameter->block_shape_[1] = 2; parameter->crops_[0] = 0; @@ -78,7 +77,6 @@ TEST_F(BatchToSpaceInferTest, BatchToSpaceInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; BatchToSpaceParameter *parameter = new BatchToSpaceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->block_shape_[0] = 2; parameter->block_shape_[1] = 2; parameter->crops_[0] = 0; @@ -118,7 +116,6 @@ TEST_F(BatchToSpaceInferTest, BatchToSpaceInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; BatchToSpaceParameter *parameter = new BatchToSpaceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->block_shape_[0] = 2; parameter->block_shape_[1] = 2; parameter->crops_[0] = 0; @@ -158,7 +155,6 @@ TEST_F(BatchToSpaceInferTest, BatchToSpaceInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; BatchToSpaceParameter *parameter = new BatchToSpaceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->block_shape_[0] = 2; parameter->block_shape_[1] = 2; parameter->crops_[0] = 0; diff --git a/mindspore/lite/test/ut/nnacl/infer/bias_grad_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/bias_grad_infer_test.cc index c248e12f2e..55c5d2de7e 100644 --- a/mindspore/lite/test/ut/nnacl/infer/bias_grad_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/bias_grad_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(BiasGradInferTest, BiasGradInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = BiasGradInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/binary_cross_entropy_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/binary_cross_entropy_infer_test.cc index 0ada9c4670..b6a7e3f83e 100644 --- a/mindspore/lite/test/ut/nnacl/infer/binary_cross_entropy_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/binary_cross_entropy_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(BinaryCrossEntropyInferTest, BinaryCrossEntropyInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; BinaryCrossEntropyParameter *parameter = new BinaryCrossEntropyParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->reduction = 3; int ret = BinaryCrossEntropyInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -66,7 +65,6 @@ TEST_F(BinaryCrossEntropyInferTest, BinaryCrossEntropyInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; BinaryCrossEntropyParameter *parameter = new BinaryCrossEntropyParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->reduction = 2; int ret = BinaryCrossEntropyInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/bn_grad_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/bn_grad_infer_test.cc index 6ba5c140d8..8fbabbca84 100644 --- a/mindspore/lite/test/ut/nnacl/infer/bn_grad_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/bn_grad_infer_test.cc @@ -50,7 +50,6 @@ TEST_F(BnGradInferTest, BnGradInferTest0) { outputs[1] = new TensorC; outputs[2] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = BnGradInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/broadcast_to_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/broadcast_to_infer_test.cc index 875e903d10..31e2b55c8c 100644 --- a/mindspore/lite/test/ut/nnacl/infer/broadcast_to_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/broadcast_to_infer_test.cc @@ -33,7 +33,6 @@ TEST_F(BroadcastToInferTest, BroadcastToInferTest0) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; BroadcastToParameter *param = new BroadcastToParameter; - param->op_parameter_.infer_flag_ = true; param->shape_size_ = 2; param->shape_[0] = 5; param->shape_[1] = 4; @@ -63,7 +62,6 @@ TEST_F(BroadcastToInferTest, BroadcastToInferTest1) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; BroadcastToParameter *param = new BroadcastToParameter; - param->op_parameter_.infer_flag_ = true; param->shape_size_ = 3; param->shape_[0] = 3; param->shape_[1] = 3; @@ -96,7 +94,6 @@ TEST_F(BroadcastToInferTest, BroadcastToInferTest2) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; BroadcastToParameter *param = new BroadcastToParameter; - param->op_parameter_.infer_flag_ = true; param->shape_size_ = 4; param->shape_[0] = 4; param->shape_[1] = 5; @@ -131,7 +128,6 @@ TEST_F(BroadcastToInferTest, BroadcastToInferTest3) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; BroadcastToParameter *param = new BroadcastToParameter; - param->op_parameter_.infer_flag_ = true; param->shape_size_ = 4; param->shape_[0] = 4; param->shape_[1] = 5; diff --git a/mindspore/lite/test/ut/nnacl/infer/cast_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/cast_infer_test.cc index 07e260601e..b9820dd7b4 100644 --- a/mindspore/lite/test/ut/nnacl/infer/cast_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/cast_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(CastInferTest, CastInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = CastInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/concat_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/concat_infer_test.cc index c928807a6d..03624cfd13 100644 --- a/mindspore/lite/test/ut/nnacl/infer/concat_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/concat_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(ConcatInferTest, ConcatInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConcatParameter *parameter = new ConcatParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_ = 0; int ret = ConcatInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -68,7 +67,6 @@ TEST_F(ConcatInferTest, ConcatInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConcatParameter *parameter = new ConcatParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_ = 1; int ret = ConcatInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -101,7 +99,6 @@ TEST_F(ConcatInferTest, ConcatInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConcatParameter *parameter = new ConcatParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_ = 0; int ret = ConcatInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -137,7 +134,6 @@ TEST_F(ConcatInferTest, ConcatInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConcatParameter *parameter = new ConcatParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_ = 0; int ret = ConcatInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -174,7 +170,6 @@ TEST_F(ConcatInferTest, ConcatInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConcatParameter *parameter = new ConcatParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_ = -1; int ret = ConcatInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -223,7 +218,6 @@ TEST_F(ConcatInferTest, ConcatInferTest5) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConcatParameter *parameter = new ConcatParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_ = 3; int ret = ConcatInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/constant_of_shape_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/constant_of_shape_infer_test.cc index c5472c26ef..792ea55bf7 100644 --- a/mindspore/lite/test/ut/nnacl/infer/constant_of_shape_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/constant_of_shape_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(ConstantOfShapeInferTest, ConstantOfShapeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConstantOfShapeParameter *parameter = new ConstantOfShapeParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->data_type_ = kNumberTypeInt8; int ret = ConstantOfShapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/conv2d_grad_filter_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/conv2d_grad_filter_infer_test.cc index b521e064af..868768e827 100644 --- a/mindspore/lite/test/ut/nnacl/infer/conv2d_grad_filter_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/conv2d_grad_filter_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(Conv2dGradFilterInferTest, Conv2dGradFilterInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConvParameter *parameter = new ConvParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dGradFilterInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/conv2d_grad_input_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/conv2d_grad_input_infer_test.cc index 6b9d6da691..12e0fbb174 100644 --- a/mindspore/lite/test/ut/nnacl/infer/conv2d_grad_input_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/conv2d_grad_input_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(Conv2dGradInputInferTest, Conv2dGradInputInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConvParameter *parameter = new ConvParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dGradInputInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/conv2d_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/conv2d_infer_test.cc index 8496cec6d9..749cddb28e 100644 --- a/mindspore/lite/test/ut/nnacl/infer/conv2d_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/conv2d_infer_test.cc @@ -51,7 +51,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest0) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -97,7 +96,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest1) { parameter->pad_r_ = 3; parameter->pad_d_ = 3; parameter->pad_u_ = 3; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -144,7 +142,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest2) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -191,7 +188,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest3) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -238,7 +234,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest4) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -285,7 +280,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest5) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -332,7 +326,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest6) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -379,7 +372,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest7) { parameter->pad_r_ = 0; parameter->pad_d_ = 4; parameter->pad_u_ = 4; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -426,7 +418,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest8) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -473,7 +464,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest9) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -520,7 +510,6 @@ TEST_F(Conv2dInferTest, Conv2dInferTest10) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = Conv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/crop_and_resize_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/crop_and_resize_infer_test.cc index 1dec7f9015..01cfd8a166 100644 --- a/mindspore/lite/test/ut/nnacl/infer/crop_and_resize_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/crop_and_resize_infer_test.cc @@ -51,7 +51,6 @@ TEST_F(CropAndResizeInferTest, CropAndResizeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = CropAndResizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -103,7 +102,6 @@ TEST_F(CropAndResizeInferTest, CropAndResizeInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = CropAndResizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/crop_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/crop_infer_test.cc index 46138a8721..5318b24a6b 100644 --- a/mindspore/lite/test/ut/nnacl/infer/crop_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/crop_infer_test.cc @@ -40,7 +40,6 @@ TEST_F(CropInferTest, CropInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; CropParameter *parameter = new CropParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = CropInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/cumsum_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/cumsum_infer_test.cc index ae61313f7b..e66522f0c8 100644 --- a/mindspore/lite/test/ut/nnacl/infer/cumsum_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/cumsum_infer_test.cc @@ -41,7 +41,6 @@ TEST_F(CumSumInferTest, Test0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; CumSumParameter *parameter = new CumSumParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = CumsumInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/custom_extract_features_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/custom_extract_features_infer_test.cc index fb746cb94c..3062d4f59d 100644 --- a/mindspore/lite/test/ut/nnacl/infer/custom_extract_features_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/custom_extract_features_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(CustomExtractFeaturesInferTest, CustomExtractFeaturesInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = CustomExtractFeaturesInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -72,7 +71,6 @@ TEST_F(CustomExtractFeaturesInferTest, CustomExtractFeaturesInferTest1) { outputs[0] = new TensorC; outputs[1] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = CustomExtractFeaturesInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/custom_normalize_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/custom_normalize_infer_test.cc index cb8cbc6a78..9b932f2849 100644 --- a/mindspore/lite/test/ut/nnacl/infer/custom_normalize_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/custom_normalize_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(CustomNormalizeInferTest, CustomNormalizeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = CustomNormalizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -66,7 +65,6 @@ TEST_F(CustomNormalizeInferTest, CustomNormalizeInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = CustomNormalizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/custom_predict_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/custom_predict_infer_test.cc index 7c83c537ea..62cf10fa8a 100644 --- a/mindspore/lite/test/ut/nnacl/infer/custom_predict_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/custom_predict_infer_test.cc @@ -33,7 +33,6 @@ TEST_F(CustomPredictInferTest, CustomPredictInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; CustomPredictParameter *parameter = new CustomPredictParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->output_num = 5; int ret = CustomPredictInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/deconv2d_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/deconv2d_infer_test.cc index 423297796f..aa2360f0f4 100644 --- a/mindspore/lite/test/ut/nnacl/infer/deconv2d_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/deconv2d_infer_test.cc @@ -54,7 +54,6 @@ TEST_F(Deconv2dInferTest, Deconv2dInferTest0) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = Deconv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -103,7 +102,6 @@ TEST_F(Deconv2dInferTest, Deconv2dInferTest1) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = Deconv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -152,7 +150,6 @@ TEST_F(Deconv2dInferTest, Deconv2dInferTest2) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = Deconv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/dedepthwise_conv2d_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/dedepthwise_conv2d_infer_test.cc index 221df87c63..de3e717509 100644 --- a/mindspore/lite/test/ut/nnacl/infer/dedepthwise_conv2d_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/dedepthwise_conv2d_infer_test.cc @@ -54,7 +54,6 @@ TEST_F(DeDepthwiseConv2DInferTest, DeDepthwiseConv2DInferTest0) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; parameter->channel_multiplie_ = 1; int ret = DeDepthwiseConv2DInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -105,7 +104,6 @@ TEST_F(DeDepthwiseConv2DInferTest, DeDepthwiseConv2DInferTest1) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = DeDepthwiseConv2DInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -155,7 +153,6 @@ TEST_F(DeDepthwiseConv2DInferTest, DeDepthwiseConv2DInferTest2) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = DeDepthwiseConv2DInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/depth_to_space_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/depth_to_space_infer_test.cc index ac29f68fff..2da3b2daf4 100644 --- a/mindspore/lite/test/ut/nnacl/infer/depth_to_space_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/depth_to_space_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(DepthToSpaceInferTest, DepthToSpaceInferTest0) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; DepthToSpaceParameter *param = new DepthToSpaceParameter; - param->op_parameter_.infer_flag_ = true; param->block_size_ = 2; int ret = DepthToSpaceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); @@ -69,7 +68,6 @@ TEST_F(DepthToSpaceInferTest, DepthToSpaceInferTest1) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; DepthToSpaceParameter *param = new DepthToSpaceParameter; - param->op_parameter_.infer_flag_ = true; param->block_size_ = 2; int ret = DepthToSpaceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); @@ -101,7 +99,6 @@ TEST_F(DepthToSpaceInferTest, DepthToSpaceInferTest2) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; DepthToSpaceParameter *param = new DepthToSpaceParameter; - param->op_parameter_.infer_flag_ = true; param->block_size_ = 2; int ret = DepthToSpaceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); @@ -133,7 +130,6 @@ TEST_F(DepthToSpaceInferTest, DepthToSpaceInferTest3) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; DepthToSpaceParameter *param = new DepthToSpaceParameter; - param->op_parameter_.infer_flag_ = true; param->block_size_ = 4; int ret = DepthToSpaceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); @@ -164,7 +160,6 @@ TEST_F(DepthToSpaceInferTest, DepthToSpaceInferTest4) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; DepthToSpaceParameter *param = new DepthToSpaceParameter; - param->op_parameter_.infer_flag_ = true; param->block_size_ = 4; int ret = DepthToSpaceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); diff --git a/mindspore/lite/test/ut/nnacl/infer/depthwise_conv2d_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/depthwise_conv2d_infer_test.cc index 64fd5c0466..74e9d27e9c 100644 --- a/mindspore/lite/test/ut/nnacl/infer/depthwise_conv2d_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/depthwise_conv2d_infer_test.cc @@ -52,7 +52,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest0) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -99,7 +98,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest1) { parameter->pad_r_ = 3; parameter->pad_d_ = 3; parameter->pad_u_ = 3; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -147,7 +145,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest2) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -195,7 +192,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest3) { parameter->pad_r_ = 1; parameter->pad_d_ = 1; parameter->pad_u_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -243,7 +239,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest4) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -291,7 +286,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest5) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -339,7 +333,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest6) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -387,7 +380,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest7) { parameter->pad_r_ = 0; parameter->pad_d_ = 4; parameter->pad_u_ = 4; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -435,7 +427,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest8) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -483,7 +474,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest9) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -531,7 +521,6 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest10) { parameter->pad_r_ = 0; parameter->pad_d_ = 0; parameter->pad_u_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = DepthwiseConv2dInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/detection_post_process_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/detection_post_process_infer_test.cc index 733af06b60..9dcca21df6 100644 --- a/mindspore/lite/test/ut/nnacl/infer/detection_post_process_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/detection_post_process_infer_test.cc @@ -44,7 +44,6 @@ TEST_F(DetectionPostProcessInferTest, DetectionPostProcessInferTest0) { outputs[2] = new TensorC; outputs[3] = new TensorC; DetectionPostProcessParameter *parameter = new DetectionPostProcessParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->max_detections_ = 20; parameter->max_classes_per_detection_ = 3; parameter->num_classes_ = 10; diff --git a/mindspore/lite/test/ut/nnacl/infer/dropout_grad_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/dropout_grad_infer_test.cc index 4244a2ca01..758205e438 100644 --- a/mindspore/lite/test/ut/nnacl/infer/dropout_grad_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/dropout_grad_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(DropoutGradInferTest, DropoutGradInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = DropoutGradInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/embedding_lookup_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/embedding_lookup_infer_test.cc index 38bbdf4b28..98b8cf2474 100644 --- a/mindspore/lite/test/ut/nnacl/infer/embedding_lookup_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/embedding_lookup_infer_test.cc @@ -47,7 +47,6 @@ TEST_F(EmbeddingLookupInferTest, EmbeddingLookupInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = EmbeddingLookupInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/expand_dims_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/expand_dims_infer_test.cc index 7faf1f1b26..92c099f863 100644 --- a/mindspore/lite/test/ut/nnacl/infer/expand_dims_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/expand_dims_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(ExpandDimsInferTest, ExpandDimsInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ExpandDimsInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); @@ -70,7 +69,6 @@ TEST_F(ExpandDimsInferTest, ExpandDimsInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ExpandDimsInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); @@ -103,7 +101,6 @@ TEST_F(ExpandDimsInferTest, ExpandDimsInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ExpandDimsInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), parameter); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/fft_imag_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/fft_imag_infer_test.cc index 190783e3ee..3073083181 100644 --- a/mindspore/lite/test/ut/nnacl/infer/fft_imag_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/fft_imag_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(FftImagInferTest, FftImagInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = FftImagInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/fill_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/fill_infer_test.cc index 57d6a8352b..00abf12fd5 100644 --- a/mindspore/lite/test/ut/nnacl/infer/fill_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/fill_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(FillInferTest, FillInferTest0) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; FillParameter *parameter = new FillParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->num_dims_ = 4; parameter->dims_[0] = 1; parameter->dims_[1] = 2; @@ -66,7 +65,6 @@ TEST_F(FillInferTest, FillInferTest1) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; FillParameter *parameter = new FillParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->num_dims_ = 3; parameter->dims_[0] = 4; parameter->dims_[1] = 2; @@ -94,7 +92,6 @@ TEST_F(FillInferTest, FillInferTest2) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; FillParameter *parameter = new FillParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->num_dims_ = 2; parameter->dims_[0] = 4; parameter->dims_[1] = 2; @@ -120,7 +117,6 @@ TEST_F(FillInferTest, FillInferTest3) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; FillParameter *parameter = new FillParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->num_dims_ = 1; parameter->dims_[0] = 4; int ret = FillInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), diff --git a/mindspore/lite/test/ut/nnacl/infer/flatten_grad_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/flatten_grad_infer_test.cc index c8fe390bea..686fdf22a5 100644 --- a/mindspore/lite/test/ut/nnacl/infer/flatten_grad_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/flatten_grad_infer_test.cc @@ -38,7 +38,6 @@ TEST_F(FlattenGradInferTest, FlattenGradInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = FlattenGradInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/flatten_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/flatten_infer_test.cc index 79b1d812e2..f815279349 100644 --- a/mindspore/lite/test/ut/nnacl/infer/flatten_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/flatten_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(FlattenInferTest, FlattenInferTest0) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; OpParameter *param = new OpParameter; - param->infer_flag_ = true; int ret = FlattenInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), param); ASSERT_EQ(ret, NNACL_OK); ASSERT_EQ(outputs[0]->shape_size_, 2); @@ -61,7 +60,6 @@ TEST_F(FlattenInferTest, FlattenInferTest1) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; OpParameter *param = new OpParameter; - param->infer_flag_ = true; int ret = FlattenInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), param); ASSERT_EQ(ret, NNACL_OK); ASSERT_EQ(outputs[0]->shape_size_, 2); @@ -86,7 +84,6 @@ TEST_F(FlattenInferTest, FlattenInferTest2) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; OpParameter *param = new OpParameter; - param->infer_flag_ = true; int ret = FlattenInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), param); ASSERT_EQ(ret, NNACL_OK); ASSERT_EQ(outputs[0]->shape_size_, 2); @@ -110,7 +107,6 @@ TEST_F(FlattenInferTest, FlattenInferTest3) { std::vector outputs(inputs_size, NULL); outputs[0] = new TensorC; OpParameter *param = new OpParameter; - param->infer_flag_ = true; int ret = FlattenInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), param); ASSERT_EQ(ret, NNACL_OK); ASSERT_EQ(outputs[0]->shape_size_, 2); diff --git a/mindspore/lite/test/ut/nnacl/infer/full_connection_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/full_connection_infer_test.cc index 965765f1f1..0dd33a6a9c 100644 --- a/mindspore/lite/test/ut/nnacl/infer/full_connection_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/full_connection_infer_test.cc @@ -40,7 +40,6 @@ TEST_F(FullConnectionInferTest, FullConnectionInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; MatMulParameter *param = new MatMulParameter; - param->op_parameter_.infer_flag_ = true; param->has_bias_ = false; param->use_axis_ = false; int ret = FullConnectionInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -72,7 +71,6 @@ TEST_F(FullConnectionInferTest, FullConnectionInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; MatMulParameter *param = new MatMulParameter; - param->op_parameter_.infer_flag_ = true; param->has_bias_ = false; param->use_axis_ = false; int ret = FullConnectionInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -104,7 +102,6 @@ TEST_F(FullConnectionInferTest, FullConnectionInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; MatMulParameter *param = new MatMulParameter; - param->op_parameter_.infer_flag_ = true; param->has_bias_ = false; param->use_axis_ = false; int ret = FullConnectionInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), diff --git a/mindspore/lite/test/ut/nnacl/infer/fused_batchnorm_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/fused_batchnorm_infer_test.cc index b772aabb1e..5df7e3e20a 100644 --- a/mindspore/lite/test/ut/nnacl/infer/fused_batchnorm_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/fused_batchnorm_infer_test.cc @@ -42,7 +42,6 @@ TEST_F(FusedBatchNormInferTest, FusedBatchNormInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = FusedBatchNormInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/gather_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/gather_infer_test.cc index 96739ca91f..079c9c3c7d 100644 --- a/mindspore/lite/test/ut/nnacl/infer/gather_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/gather_infer_test.cc @@ -38,7 +38,6 @@ TEST_F(GatherInferTest, GatherInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherParameter *param = new GatherParameter; - param->op_parameter_.infer_flag_ = true; param->axis_ = 0; int ret = GatherInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); @@ -71,7 +70,6 @@ TEST_F(GatherInferTest, GatherInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherParameter *param = new GatherParameter; - param->op_parameter_.infer_flag_ = true; param->axis_ = 0; int ret = GatherInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); @@ -104,7 +102,6 @@ TEST_F(GatherInferTest, GatherInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherParameter *param = new GatherParameter; - param->op_parameter_.infer_flag_ = true; param->axis_ = 0; int ret = GatherInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); @@ -136,7 +133,6 @@ TEST_F(GatherInferTest, GatherInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherParameter *param = new GatherParameter; - param->op_parameter_.infer_flag_ = true; param->axis_ = 0; int ret = GatherInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); @@ -170,7 +166,6 @@ TEST_F(GatherInferTest, GatherInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherParameter *param = new GatherParameter; - param->op_parameter_.infer_flag_ = true; param->axis_ = 0; int ret = GatherInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(param)); diff --git a/mindspore/lite/test/ut/nnacl/infer/gather_nd_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/gather_nd_infer_test.cc index 217944e99d..2751e0afcc 100644 --- a/mindspore/lite/test/ut/nnacl/infer/gather_nd_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/gather_nd_infer_test.cc @@ -38,7 +38,6 @@ TEST_F(GatherNdInferTest, GatherNdInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherNdParameter *parameter = new GatherNdParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = GatherNdInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -70,7 +69,6 @@ TEST_F(GatherNdInferTest, GatherNdInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherNdParameter *parameter = new GatherNdParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = GatherNdInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -102,7 +100,6 @@ TEST_F(GatherNdInferTest, GatherNdInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherNdParameter *parameter = new GatherNdParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = GatherNdInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -133,7 +130,6 @@ TEST_F(GatherNdInferTest, GatherNdInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherNdParameter *parameter = new GatherNdParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = GatherNdInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -167,7 +163,6 @@ TEST_F(GatherNdInferTest, GatherNdInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; GatherNdParameter *parameter = new GatherNdParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = GatherNdInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/group_conv2d_grad_input_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/group_conv2d_grad_input_infer_test.cc index 12b162f899..f687aa7dd2 100644 --- a/mindspore/lite/test/ut/nnacl/infer/group_conv2d_grad_input_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/group_conv2d_grad_input_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(GroupConv2dGradInputInferTest, GroupConv2dGradInputInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ConvParameter *parameter = new ConvParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = GroupConv2dGradInputInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/gru_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/gru_infer_test.cc index df24fe9b54..43bfe04745 100644 --- a/mindspore/lite/test/ut/nnacl/infer/gru_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/gru_infer_test.cc @@ -47,7 +47,6 @@ TEST_F(GruInferTest, GruInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; GruParameter *parameter = new GruParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->bidirectional_ = true; OpParameter *param = reinterpret_cast(parameter); int ret = GruInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), param); @@ -103,7 +102,6 @@ TEST_F(GruInferTest, GruInferTest1) { outputs[0] = new TensorC; outputs[1] = new TensorC; GruParameter *parameter = new GruParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->bidirectional_ = false; int ret = GruInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/hashtable_lookup_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/hashtable_lookup_infer_test.cc index a9a02b6a47..b6dbf4b608 100644 --- a/mindspore/lite/test/ut/nnacl/infer/hashtable_lookup_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/hashtable_lookup_infer_test.cc @@ -40,7 +40,6 @@ TEST_F(HashtableLookupInferTest, HashtableLookupInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = HashtableLoopupInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_INFER_INVALID); diff --git a/mindspore/lite/test/ut/nnacl/infer/infer_manager_test.cc b/mindspore/lite/test/ut/nnacl/infer/infer_manager_test.cc index 7d03d9c0e3..d4ce76a283 100644 --- a/mindspore/lite/test/ut/nnacl/infer/infer_manager_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/infer_manager_test.cc @@ -41,7 +41,6 @@ TEST_F(InferManagerTest, InferManagerTest0) { inputs.push_back(tensor1); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; parameter->type_ = mindspore::schema::PrimitiveType_TensorListFromTensor; std::vector outputs; @@ -118,7 +117,6 @@ TEST_F(InferManagerTest, InferManagerTest1) { inputs.push_back(tensor2); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; parameter->type_ = mindspore::schema::PrimitiveType_TensorListGetItem; std::vector outputs; @@ -162,7 +160,6 @@ TEST_F(InferManagerTest, InferManagerTest2) { inputs.push_back(tensor1); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; parameter->type_ = mindspore::schema::PrimitiveType_TensorListReserve; std::vector outputs; diff --git a/mindspore/lite/test/ut/nnacl/infer/invert_permutation_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/invert_permutation_infer_test.cc index b44411fe1c..78b5666f6e 100644 --- a/mindspore/lite/test/ut/nnacl/infer/invert_permutation_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/invert_permutation_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(InvertPermutationInferTest, InvertPermutationInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = InvertPermutationInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/layer_norm_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/layer_norm_infer_test.cc index ac80e1ef80..122c5d7836 100644 --- a/mindspore/lite/test/ut/nnacl/infer/layer_norm_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/layer_norm_infer_test.cc @@ -33,7 +33,6 @@ TEST_F(LayerNormInferTest, LayerNormInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; LayerNormParameter *parameter = new LayerNormParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->normalized_dims_ = 1; parameter->elementwise_affine_ = false; parameter->normalized_shape_[0] = 3; @@ -62,7 +61,6 @@ TEST_F(LayerNormInferTest, LayerNormInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; LayerNormParameter *parameter = new LayerNormParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->normalized_dims_ = 3; parameter->elementwise_affine_ = false; parameter->normalized_shape_[0] = 3; @@ -88,7 +86,6 @@ TEST_F(LayerNormInferTest, LayerNormInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; LayerNormParameter *parameter = new LayerNormParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->normalized_dims_ = 2; parameter->elementwise_affine_ = false; parameter->normalized_shape_[0] = 3; diff --git a/mindspore/lite/test/ut/nnacl/infer/lsh_projection_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/lsh_projection_infer_test.cc index cbbe962da0..9b27f538cb 100644 --- a/mindspore/lite/test/ut/nnacl/infer/lsh_projection_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/lsh_projection_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(LshProjectionInferTest, LshProjectionInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; LshProjectionParameter *parameter = new LshProjectionParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->lsh_type_ = LshProjectionType_SPARSE; int ret = LshProjectionInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -69,7 +68,6 @@ TEST_F(LshProjectionInferTest, LshProjectionInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; LshProjectionParameter *parameter = new LshProjectionParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->lsh_type_ = LshProjectionType_DENSE; int ret = LshProjectionInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -105,7 +103,6 @@ TEST_F(LshProjectionInferTest, LshProjectionInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; LshProjectionParameter *parameter = new LshProjectionParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->lsh_type_ = LshProjectionType_DENSE; int ret = LshProjectionInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/lstm_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/lstm_infer_test.cc index 7ed9da8b4c..ef24be40e6 100644 --- a/mindspore/lite/test/ut/nnacl/infer/lstm_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/lstm_infer_test.cc @@ -50,7 +50,6 @@ TEST_F(LstmInferTest, LstmInferTest0) { outputs[2] = new TensorC; LstmParameter *parameter = new LstmParameter; parameter->bidirectional_ = false; - parameter->op_parameter_.infer_flag_ = true; int ret = LstmInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/matmul_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/matmul_infer_test.cc index ac41e3e6cd..1c2c807dfd 100644 --- a/mindspore/lite/test/ut/nnacl/infer/matmul_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/matmul_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(MatmulInferTest, MatmulInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; MatMulParameter *parameter = new MatMulParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->a_transpose_ = false; parameter->b_transpose_ = true; int ret = MatmulInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -71,7 +70,6 @@ TEST_F(MatmulInferTest, MatmulInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; MatMulParameter *parameter = new MatMulParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->a_transpose_ = false; parameter->b_transpose_ = false; int ret = MatmulInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -106,7 +104,6 @@ TEST_F(MatmulInferTest, MatmulInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; MatMulParameter *parameter = new MatMulParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->a_transpose_ = false; parameter->b_transpose_ = true; int ret = MatmulInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -141,7 +138,6 @@ TEST_F(MatmulInferTest, MatmulInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; MatMulParameter *parameter = new MatMulParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->a_transpose_ = false; parameter->b_transpose_ = true; int ret = MatmulInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), diff --git a/mindspore/lite/test/ut/nnacl/infer/max_min_grad_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/max_min_grad_infer_test.cc index 51ab932a09..ba61342afe 100644 --- a/mindspore/lite/test/ut/nnacl/infer/max_min_grad_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/max_min_grad_infer_test.cc @@ -46,7 +46,6 @@ TEST_F(MaxMinGradInferTest, MaxMinGradInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; ArithmeticParameter *parameter = new ArithmeticParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = MaxMinGradInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/mean_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/mean_infer_test.cc index 785ed224da..bacc372716 100644 --- a/mindspore/lite/test/ut/nnacl/infer/mean_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/mean_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(MeanInferTest, MeanInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = false; parameter->axes_[0] = 1; parameter->num_axes_ = 1; @@ -62,7 +61,6 @@ TEST_F(MeanInferTest, MeanInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = true; parameter->axes_[0] = 1; parameter->num_axes_ = 1; @@ -92,7 +90,6 @@ TEST_F(MeanInferTest, MeanInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = true; parameter->axes_[0] = 0; parameter->axes_[1] = 1; @@ -125,7 +122,6 @@ TEST_F(MeanInferTest, MeanInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = true; parameter->num_axes_ = 2; parameter->axes_[0] = 1; @@ -159,7 +155,6 @@ TEST_F(MeanInferTest, MeanInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = false; parameter->num_axes_ = 2; parameter->axes_[0] = 1; diff --git a/mindspore/lite/test/ut/nnacl/infer/mfcc_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/mfcc_infer_test.cc index 77c2b758a3..f6c2a615c8 100644 --- a/mindspore/lite/test/ut/nnacl/infer/mfcc_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/mfcc_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(MfccInferTest, MfccInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; MfccParameter *parameter = new MfccParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->dct_coeff_num_ = 5; int ret = MfccInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/one_hot_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/one_hot_infer_test.cc index 272fac3500..0324351882 100644 --- a/mindspore/lite/test/ut/nnacl/infer/one_hot_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/one_hot_infer_test.cc @@ -38,7 +38,6 @@ TEST_F(OneHotInferTest, OneHotInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OneHotParameter *parameter = new OneHotParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_ = -2; int ret = OneHotInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/pad_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/pad_infer_test.cc index 33750ea023..2c6473e103 100644 --- a/mindspore/lite/test/ut/nnacl/infer/pad_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/pad_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(PadInferTest, PadInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PadParameter *parameter = new PadParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = PadInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -65,7 +64,6 @@ TEST_F(PadInferTest, PadInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PadParameter *parameter = new PadParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->padding_length = 4; parameter->paddings_[0] = 1; parameter->paddings_[1] = 1; @@ -97,7 +95,6 @@ TEST_F(PadInferTest, PadInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PadParameter *parameter = new PadParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->padding_length = 6; parameter->paddings_[0] = 0; parameter->paddings_[1] = 0; @@ -138,7 +135,6 @@ TEST_F(PadInferTest, PadInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PadParameter *parameter = new PadParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = PadInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -173,7 +169,6 @@ TEST_F(PadInferTest, PadInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PadParameter *parameter = new PadParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = PadInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/pooling_grad_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/pooling_grad_infer_test.cc index c56fe48034..c58b69e021 100644 --- a/mindspore/lite/test/ut/nnacl/infer/pooling_grad_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/pooling_grad_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(PoolingGradInferTest, PoolingGradInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PoolingParameter *parameter = new PoolingParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->window_w_ = 3; parameter->window_h_ = 3; parameter->stride_w_ = 1; diff --git a/mindspore/lite/test/ut/nnacl/infer/pooling_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/pooling_infer_test.cc index 81292c1985..741c16231a 100644 --- a/mindspore/lite/test/ut/nnacl/infer/pooling_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/pooling_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(PoolingInferTest, PoolingInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PoolingParameter *parameter = new PoolingParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->window_w_ = 2; parameter->window_h_ = 2; parameter->stride_w_ = 2; @@ -76,7 +75,6 @@ TEST_F(PoolingInferTest, PoolingInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PoolingParameter *parameter = new PoolingParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->window_w_ = 3; parameter->window_h_ = 3; parameter->stride_w_ = 1; @@ -118,7 +116,6 @@ TEST_F(PoolingInferTest, PoolingInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PoolingParameter *parameter = new PoolingParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->window_w_ = 3; parameter->window_h_ = 3; parameter->stride_w_ = 2; @@ -160,7 +157,6 @@ TEST_F(PoolingInferTest, PoolingInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PoolingParameter *parameter = new PoolingParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->window_w_ = 7; parameter->window_h_ = 7; parameter->stride_w_ = 1; @@ -202,7 +198,6 @@ TEST_F(PoolingInferTest, PoolingInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PoolingParameter *parameter = new PoolingParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->window_w_ = 2; parameter->window_h_ = 2; parameter->stride_w_ = 2; @@ -244,7 +239,6 @@ TEST_F(PoolingInferTest, PoolingInferTest5) { std::vector outputs(1, NULL); outputs[0] = new TensorC; PoolingParameter *parameter = new PoolingParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->window_w_ = 2; parameter->window_h_ = 2; parameter->stride_w_ = 2; diff --git a/mindspore/lite/test/ut/nnacl/infer/power_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/power_infer_test.cc index 74241f3c45..dc7b10f7ce 100644 --- a/mindspore/lite/test/ut/nnacl/infer/power_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/power_infer_test.cc @@ -33,7 +33,6 @@ TEST_F(PowerInferTest, PowerInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = PowerInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -65,7 +64,6 @@ TEST_F(PowerInferTest, PowerInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = PowerInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -96,7 +94,6 @@ TEST_F(PowerInferTest, PowerInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = PowerInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/quant_dtype_cast_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/quant_dtype_cast_infer_test.cc index 895d77c831..9d60d2f495 100644 --- a/mindspore/lite/test/ut/nnacl/infer/quant_dtype_cast_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/quant_dtype_cast_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(QuantDtypeCastInferTest, QuantDtypeCastInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; QuantDtypeCastParameter *parameter = new QuantDtypeCastParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->srcT_ = kNumberTypeFloat32; parameter->dstT_ = kNumberTypeInt; int ret = QuantDtypeCastInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), diff --git a/mindspore/lite/test/ut/nnacl/infer/random_standard_normal_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/random_standard_normal_infer_test.cc index c02c52cf27..ab81dcdecd 100644 --- a/mindspore/lite/test/ut/nnacl/infer/random_standard_normal_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/random_standard_normal_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(RandomStandardNormalInferTest, RandomStandardNormalInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = RandomStandardNormalInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/range_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/range_infer_test.cc index 081c9a9a23..1f0e0086a3 100644 --- a/mindspore/lite/test/ut/nnacl/infer/range_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/range_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(RangeInferTest, RangeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; RangeParameter *parameter = new RangeParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->limit_ = 18; parameter->start_ = 3; parameter->delta_ = 3; // delta must be decimal @@ -74,7 +73,6 @@ TEST_F(RangeInferTest, RangeInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; RangeParameter *parameter = new RangeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->limit_ = 18; // parameter->start_ = 3; // parameter->delta_ = 3; @@ -114,7 +112,6 @@ TEST_F(RangeInferTest, RangeInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; RangeParameter *parameter = new RangeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->limit_ = 18; // parameter->start_ = 3; // parameter->delta_ = 3; diff --git a/mindspore/lite/test/ut/nnacl/infer/rank_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/rank_infer_test.cc index b7fea7db2d..8b6000c6c0 100644 --- a/mindspore/lite/test/ut/nnacl/infer/rank_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/rank_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(RankInferTest, RankInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = RankInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/reduce_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/reduce_infer_test.cc index 85ff609124..205c6d6c57 100644 --- a/mindspore/lite/test/ut/nnacl/infer/reduce_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/reduce_infer_test.cc @@ -33,7 +33,6 @@ TEST_F(ReduceInferTest, ReduceInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = false; parameter->axes_[0] = 1; parameter->num_axes_ = 1; @@ -62,7 +61,6 @@ TEST_F(ReduceInferTest, ReduceInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = true; parameter->axes_[0] = 1; parameter->num_axes_ = 1; @@ -93,7 +91,6 @@ TEST_F(ReduceInferTest, ReduceInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = true; parameter->axes_[0] = 0; parameter->axes_[1] = 1; @@ -127,7 +124,6 @@ TEST_F(ReduceInferTest, ReduceInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = true; parameter->num_axes_ = 2; parameter->axes_[0] = 1; @@ -162,7 +158,6 @@ TEST_F(ReduceInferTest, ReduceInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReduceParameter *parameter = new ReduceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->keep_dims_ = false; parameter->num_axes_ = 2; parameter->axes_[0] = 1; diff --git a/mindspore/lite/test/ut/nnacl/infer/reshape_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/reshape_infer_test.cc index 85384202e2..04d16eb1fc 100644 --- a/mindspore/lite/test/ut/nnacl/infer/reshape_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/reshape_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->shape_dim_ = 1; parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -67,7 +66,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -100,7 +98,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -133,7 +130,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -165,7 +161,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -198,7 +193,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest5) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -233,7 +227,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest6) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -268,7 +261,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest7) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -302,7 +294,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest8) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -338,7 +329,6 @@ TEST_F(ReshapeInferTest, ReshapeInferTest9) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ReshapeParameter *parameter = new ReshapeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->shape_size_ = 1; // parameter->shape_[0] = 6; int ret = ReshapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), diff --git a/mindspore/lite/test/ut/nnacl/infer/resize_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/resize_infer_test.cc index 82cac51a12..80f7922a4b 100644 --- a/mindspore/lite/test/ut/nnacl/infer/resize_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/resize_infer_test.cc @@ -38,7 +38,6 @@ TEST_F(ResizeInferTest, ResizeInferTest0) { ResizeParameter *parameter = new ResizeParameter; parameter->new_width_ = 2; parameter->new_height_ = 3; - parameter->op_parameter_.infer_flag_ = true; int ret = ResizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -78,7 +77,6 @@ TEST_F(ResizeInferTest, ResizeInferTest1) { ResizeParameter *parameter = new ResizeParameter; // parameter->new_width_ = 2; // parameter->new_height_ = 3; - parameter->op_parameter_.infer_flag_ = true; int ret = ResizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -118,7 +116,6 @@ TEST_F(ResizeInferTest, ResizeInferTest2) { ResizeParameter *parameter = new ResizeParameter; // parameter->new_width_ = 2; // parameter->new_height_ = 3; - parameter->op_parameter_.infer_flag_ = true; int ret = ResizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -158,7 +155,6 @@ TEST_F(ResizeInferTest, ResizeInferTest3) { ResizeParameter *parameter = new ResizeParameter; // parameter->new_width_ = 2; // parameter->new_height_ = 3; - parameter->op_parameter_.infer_flag_ = true; int ret = ResizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/rfft_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/rfft_infer_test.cc index 3a8ed61ae5..20a33e82c2 100644 --- a/mindspore/lite/test/ut/nnacl/infer/rfft_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/rfft_infer_test.cc @@ -33,7 +33,6 @@ TEST_F(RfftInferTest, RfftInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; RfftParameter *parameter = new RfftParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->fft_length_ = 4; int ret = RfftInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/roi_pooling_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/roi_pooling_infer_test.cc index 65cc8beba7..25293239b7 100644 --- a/mindspore/lite/test/ut/nnacl/infer/roi_pooling_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/roi_pooling_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(ROIPoolingInferTest, ROIPoolingInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; ROIPoolingParameter *parameter = new ROIPoolingParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->pooledW_ = 3; parameter->pooledH_ = 4; int ret = ROIPoolingInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), diff --git a/mindspore/lite/test/ut/nnacl/infer/scatter_nd_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/scatter_nd_infer_test.cc index 79b207ef7c..70efa6d318 100644 --- a/mindspore/lite/test/ut/nnacl/infer/scatter_nd_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/scatter_nd_infer_test.cc @@ -38,7 +38,6 @@ TEST_F(ScatterNdInferTest, ScatterNdInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ScatterNdInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/select_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/select_infer_test.cc index d12d7a7ca6..0bdaa09510 100644 --- a/mindspore/lite/test/ut/nnacl/infer/select_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/select_infer_test.cc @@ -46,7 +46,6 @@ TEST_F(SelectInferTest, SelectInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SelectInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -102,7 +101,6 @@ TEST_F(SelectInferTest, SelectInferTest1) { outputs[0] = new TensorC; outputs[1] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SelectInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -149,7 +147,6 @@ TEST_F(SelectInferTest, SelectInferTest2) { std::vector outputs(1, NULL); outputs[0] = reinterpret_cast(new TensorListC); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SelectInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); TensorListC *outputs0 = reinterpret_cast(outputs[0]); @@ -205,7 +202,6 @@ TEST_F(SelectInferTest, SelectInferTest3) { outputs[0] = reinterpret_cast(new TensorListC); outputs[1] = reinterpret_cast(new TensorListC); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SelectInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); TensorListC *outputs0 = reinterpret_cast(outputs[0]); diff --git a/mindspore/lite/test/ut/nnacl/infer/sgd_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/sgd_infer_test.cc index d132391eef..72c60a45cb 100644 --- a/mindspore/lite/test/ut/nnacl/infer/sgd_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/sgd_infer_test.cc @@ -48,7 +48,6 @@ TEST_F(SgdInferTest, SgdInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SgdInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/shape_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/shape_infer_test.cc index 25bfbca196..bbc10b3a59 100644 --- a/mindspore/lite/test/ut/nnacl/infer/shape_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/shape_infer_test.cc @@ -33,7 +33,6 @@ TEST_F(ShapeInferTest, ShapeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = ShapeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/size_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/size_infer_test.cc index 14210fd34a..f6e9b7d44e 100644 --- a/mindspore/lite/test/ut/nnacl/infer/size_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/size_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(SizeInferTest, SizeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SizeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/skip_gram_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/skip_gram_infer_test.cc index 4f31c1c687..469b093449 100644 --- a/mindspore/lite/test/ut/nnacl/infer/skip_gram_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/skip_gram_infer_test.cc @@ -33,7 +33,6 @@ TEST_F(SkipGramInferTest, SkipGramInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SkipGramInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_INFER_INVALID); diff --git a/mindspore/lite/test/ut/nnacl/infer/slice_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/slice_infer_test.cc index ad0865b4d9..fb09a3fb88 100644 --- a/mindspore/lite/test/ut/nnacl/infer/slice_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/slice_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(SliceInferTest, SliceInferTest0) { parameter->size_[1] = 3; parameter->axis_[0] = 0; parameter->axis_[1] = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = SliceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -75,7 +74,6 @@ TEST_F(SliceInferTest, SliceInferTest1) { parameter->axis_[0] = 0; parameter->axis_[1] = 1; parameter->axis_[2] = 2; - parameter->op_parameter_.infer_flag_ = true; int ret = SliceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -112,7 +110,6 @@ TEST_F(SliceInferTest, SliceInferTest2) { parameter->axis_[0] = 0; parameter->axis_[1] = 1; parameter->axis_[2] = 2; - parameter->op_parameter_.infer_flag_ = true; int ret = SliceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -156,7 +153,6 @@ TEST_F(SliceInferTest, SliceInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SliceParameter *parameter = new SliceParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = SliceInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/softmax_cross_entropy_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/softmax_cross_entropy_infer_test.cc index 0544657895..27a7c96ce8 100644 --- a/mindspore/lite/test/ut/nnacl/infer/softmax_cross_entropy_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/softmax_cross_entropy_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(SoftmaxCrossEntropyInferTest, SoftmaxCrossEntropyInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SoftmaxCrossEntropyInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/softmax_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/softmax_infer_test.cc index 13146760af..835845876a 100644 --- a/mindspore/lite/test/ut/nnacl/infer/softmax_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/softmax_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(SoftmaxInferTest, SoftmaxInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SoftmaxParameter *parameter = new SoftmaxParameter; - parameter->op_parameter_.infer_flag_ = true; int ret = SoftMaxInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/space_to_batch_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/space_to_batch_infer_test.cc index 524b741426..c780c35453 100644 --- a/mindspore/lite/test/ut/nnacl/infer/space_to_batch_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/space_to_batch_infer_test.cc @@ -43,7 +43,6 @@ TEST_F(SpaceToBatchInferTest, SpaceToBatchInferTest0) { parameter->paddings_[1] = 0; parameter->paddings_[2] = 0; parameter->paddings_[3] = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = SpaceToBatchInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -81,7 +80,6 @@ TEST_F(SpaceToBatchInferTest, SpaceToBatchInferTest1) { parameter->paddings_[1] = 0; parameter->paddings_[2] = 0; parameter->paddings_[3] = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = SpaceToBatchInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -119,7 +117,6 @@ TEST_F(SpaceToBatchInferTest, SpaceToBatchInferTest2) { parameter->paddings_[1] = 0; parameter->paddings_[2] = 0; parameter->paddings_[3] = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = SpaceToBatchInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -157,7 +154,6 @@ TEST_F(SpaceToBatchInferTest, SpaceToBatchInferTest3) { parameter->paddings_[1] = 0; parameter->paddings_[2] = 2; parameter->paddings_[3] = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = SpaceToBatchInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/space_to_batch_nd_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/space_to_batch_nd_infer_test.cc index c784843db5..224d3edfab 100644 --- a/mindspore/lite/test/ut/nnacl/infer/space_to_batch_nd_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/space_to_batch_nd_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(SpaceToBatchNdInferTest, SpaceToBatchNdInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SpaceToBatchParameter *parameter = new SpaceToBatchParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->m_ = 2; parameter->block_sizes_[0] = 2; parameter->block_sizes_[1] = 2; @@ -75,7 +74,6 @@ TEST_F(SpaceToBatchNdInferTest, SpaceToBatchNdInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SpaceToBatchParameter *parameter = new SpaceToBatchParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->m_ = 2; parameter->block_sizes_[0] = 2; parameter->block_sizes_[1] = 2; @@ -113,7 +111,6 @@ TEST_F(SpaceToBatchNdInferTest, SpaceToBatchNdInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SpaceToBatchParameter *parameter = new SpaceToBatchParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->m_ = 2; parameter->block_sizes_[0] = 2; parameter->block_sizes_[1] = 2; @@ -151,7 +148,6 @@ TEST_F(SpaceToBatchNdInferTest, SpaceToBatchNdInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SpaceToBatchParameter *parameter = new SpaceToBatchParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->m_ = 2; parameter->block_sizes_[0] = 2; parameter->block_sizes_[1] = 2; diff --git a/mindspore/lite/test/ut/nnacl/infer/space_to_depth_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/space_to_depth_infer_test.cc index 1e7c2d8524..4293d92173 100644 --- a/mindspore/lite/test/ut/nnacl/infer/space_to_depth_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/space_to_depth_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(SpaceToDepthInferTest, SpaceToDepthInferTest0) { outputs[0] = new TensorC; SpaceToDepthParameter *parameter = new SpaceToDepthParameter; parameter->block_size_ = 2; - parameter->op_parameter_.infer_flag_ = true; int ret = SpaceToDepthInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -69,7 +68,6 @@ TEST_F(SpaceToDepthInferTest, SpaceToDepthInferTest1) { outputs[0] = new TensorC; SpaceToDepthParameter *parameter = new SpaceToDepthParameter; parameter->block_size_ = 2; - parameter->op_parameter_.infer_flag_ = true; int ret = SpaceToDepthInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/sparse_to_dense_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/sparse_to_dense_infer_test.cc index 39f0e95051..a04d0d03c8 100644 --- a/mindspore/lite/test/ut/nnacl/infer/sparse_to_dense_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/sparse_to_dense_infer_test.cc @@ -37,7 +37,6 @@ TEST_F(SparseToDenseInferTest, SparseToDenseInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = SparseToDenseInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/split_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/split_infer_test.cc index f105a94eea..696097cfda 100644 --- a/mindspore/lite/test/ut/nnacl/infer/split_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/split_infer_test.cc @@ -40,7 +40,6 @@ TEST_F(SplitInferTest, SplitInferTest0) { std::vector split_sizes = {4, 15, 11}; parameter->split_sizes_ = split_sizes.data(); parameter->split_dim_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = SplitInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -78,7 +77,6 @@ TEST_F(SplitInferTest, SplitInferTest1) { // parameter->num_split_ = 2; // parameter->split_count_ = 0; parameter->split_dim_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = SplitInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -120,7 +118,6 @@ TEST_F(SplitInferTest, SplitInferTest2) { parameter->split_sizes_[1] = 4; parameter->split_sizes_[2] = 2; parameter->split_dim_ = 3; - parameter->op_parameter_.infer_flag_ = true; int ret = SplitInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -166,7 +163,6 @@ TEST_F(SplitInferTest, SplitInferTest3) { // parameter->num_split_ = 2; // parameter->split_count_ = 0; parameter->split_dim_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = SplitInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -207,7 +203,6 @@ TEST_F(SplitInferTest, SplitInferTest4) { // parameter->num_split_ = 2; // parameter->split_count_ = 0; parameter->split_dim_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = SplitInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/squeeze_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/squeeze_infer_test.cc index 1e42422586..3873efc667 100644 --- a/mindspore/lite/test/ut/nnacl/infer/squeeze_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/squeeze_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(SqueezeInferTest, SqueezeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SqueezeParameter *parameter = new SqueezeParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_size_ = 0; int ret = SqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -67,7 +66,6 @@ TEST_F(SqueezeInferTest, SqueezeInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SqueezeParameter *parameter = new SqueezeParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_size_ = 1; parameter->axis_[0] = 1; int ret = SqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), @@ -100,7 +98,6 @@ TEST_F(SqueezeInferTest, SqueezeInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SqueezeParameter *parameter = new SqueezeParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_size_ = 2; parameter->axis_[0] = 1; parameter->axis_[1] = 3; @@ -133,7 +130,6 @@ TEST_F(SqueezeInferTest, SqueezeInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; SqueezeParameter *parameter = new SqueezeParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_size_ = 1; parameter->axis_[0] = 0; int ret = SqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), diff --git a/mindspore/lite/test/ut/nnacl/infer/stack_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/stack_infer_test.cc index 0a5fcdb01c..7cddaab674 100644 --- a/mindspore/lite/test/ut/nnacl/infer/stack_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/stack_infer_test.cc @@ -40,7 +40,6 @@ TEST_F(StackInferTest, StackInferTest0) { outputs[0] = new TensorC; StackParameter *parameter = new StackParameter; parameter->axis_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = StackInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -74,7 +73,6 @@ TEST_F(StackInferTest, StackInferTest1) { outputs[0] = new TensorC; StackParameter *parameter = new StackParameter; parameter->axis_ = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = StackInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/strided_slice_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/strided_slice_infer_test.cc index a697d412e3..2ea2f61a14 100644 --- a/mindspore/lite/test/ut/nnacl/infer/strided_slice_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/strided_slice_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(StridedSliceInferTest, StridedSliceInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; StridedSliceParameter *parameter = new StridedSliceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->begins_[0] = 1; parameter->begins_[1] = 0; parameter->begins_[2] = 0; @@ -77,7 +76,6 @@ TEST_F(StridedSliceInferTest, StridedSliceInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; StridedSliceParameter *parameter = new StridedSliceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->begins_[0] = 1; parameter->begins_[1] = 0; parameter->begins_[2] = 0; @@ -120,7 +118,6 @@ TEST_F(StridedSliceInferTest, StridedSliceInferTest2) { std::vector outputs(1, NULL); outputs[0] = new TensorC; StridedSliceParameter *parameter = new StridedSliceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->begins_[0] = 1; parameter->begins_[1] = -1; parameter->begins_[2] = 0; @@ -161,7 +158,6 @@ TEST_F(StridedSliceInferTest, StridedSliceInferTest3) { std::vector outputs(1, NULL); outputs[0] = new TensorC; StridedSliceParameter *parameter = new StridedSliceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->begins_[0] = 0; parameter->ends_[0] = 3; parameter->strides_[0] = 1; @@ -194,7 +190,6 @@ TEST_F(StridedSliceInferTest, StridedSliceInferTest4) { std::vector outputs(1, NULL); outputs[0] = new TensorC; StridedSliceParameter *parameter = new StridedSliceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->begins_[0] = 1; parameter->ends_[0] = -2; parameter->strides_[0] = 1; @@ -251,7 +246,6 @@ TEST_F(StridedSliceInferTest, StridedSliceInferTest5) { outputs.push_back(NULL); outputs[0] = new TensorC; StridedSliceParameter *parameter = new StridedSliceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->begins_mask_ = 0; parameter->ends_mask_ = 0; parameter->ellipsisMask_ = 0; @@ -299,7 +293,6 @@ TEST_F(StridedSliceInferTest, StridedSliceInferTest6) { std::vector outputs(1, NULL); outputs[0] = new TensorC; StridedSliceParameter *parameter = new StridedSliceParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->begins_mask_ = 0; parameter->ends_mask_ = 0; parameter->ellipsisMask_ = 0; diff --git a/mindspore/lite/test/ut/nnacl/infer/tensorlist_fromtensor_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/tensorlist_fromtensor_infer_test.cc index c50cf8a403..eeefae7073 100644 --- a/mindspore/lite/test/ut/nnacl/infer/tensorlist_fromtensor_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/tensorlist_fromtensor_infer_test.cc @@ -45,7 +45,6 @@ TEST_F(TensorlistFromtensorInferTest, TensorlistFromtensorInferTest0) { std::vector outputs(1, NULL); outputs[0] = reinterpret_cast(malloc(sizeof(TensorListC))); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = TensorListFromTensorInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); TensorListC *out = reinterpret_cast(outputs[0]); diff --git a/mindspore/lite/test/ut/nnacl/infer/tensorlist_getitem_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/tensorlist_getitem_infer_test.cc index 635405eb1d..d92851cd32 100644 --- a/mindspore/lite/test/ut/nnacl/infer/tensorlist_getitem_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/tensorlist_getitem_infer_test.cc @@ -61,7 +61,6 @@ TEST_F(TensorlistGetItemInferTest, TensorlistGetItemInferTest0) { std::vector outputs(1, NULL); outputs[0] = reinterpret_cast(malloc(sizeof(TensorC))); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = TensorListGetItemInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/tensorlist_reserve_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/tensorlist_reserve_infer_test.cc index d9b41df3cf..37f9325752 100644 --- a/mindspore/lite/test/ut/nnacl/infer/tensorlist_reserve_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/tensorlist_reserve_infer_test.cc @@ -43,7 +43,6 @@ TEST_F(TensorlistReserveInferTest, TensorlistReserveInferTest0) { std::vector outputs(1, NULL); outputs[0] = reinterpret_cast(new TensorListC); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = TensorListReserveInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); TensorListC *out = reinterpret_cast(outputs[0]); diff --git a/mindspore/lite/test/ut/nnacl/infer/tensorlist_setitem_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/tensorlist_setitem_infer_test.cc index 639aa97d06..5626e5b971 100644 --- a/mindspore/lite/test/ut/nnacl/infer/tensorlist_setitem_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/tensorlist_setitem_infer_test.cc @@ -71,7 +71,6 @@ TEST_F(TensorlistSetItemInferTest, TensorlistSetItemInferTest0) { std::vector outputs(1, NULL); outputs[0] = reinterpret_cast(new TensorListC); OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = TensorListSetItemInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); TensorListC *res = reinterpret_cast(outputs[0]); diff --git a/mindspore/lite/test/ut/nnacl/infer/tensorlist_stack_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/tensorlist_stack_infer_test.cc index adebf6aa99..bf020b5e5d 100644 --- a/mindspore/lite/test/ut/nnacl/infer/tensorlist_stack_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/tensorlist_stack_infer_test.cc @@ -62,7 +62,6 @@ TEST_F(TensorlistStackInferTest, TensorlistStackInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = TensorListStackInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/tile_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/tile_infer_test.cc index 1e8d68334e..6d83a266a3 100644 --- a/mindspore/lite/test/ut/nnacl/infer/tile_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/tile_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(TileInferTest, TileInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; TileParameter *parameter = new TileParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->multiples_size_ = 2; parameter->multiples_[0] = 4; parameter->multiples_[1] = 5; @@ -68,7 +67,6 @@ TEST_F(TileInferTest, TileInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; TileParameter *parameter = new TileParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->multiples_size_ = 2; parameter->multiples_[0] = 4; parameter->multiples_[1] = 5; diff --git a/mindspore/lite/test/ut/nnacl/infer/topk_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/topk_infer_test.cc index 1a60a25378..aa01376997 100644 --- a/mindspore/lite/test/ut/nnacl/infer/topk_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/topk_infer_test.cc @@ -36,7 +36,6 @@ TEST_F(TopKInferTest, TopKInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; TopkParameter *parameter = new TopkParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->k_ = 6; int ret = TopKInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); @@ -74,7 +73,6 @@ TEST_F(TopKInferTest, TopKInferInputsSize2) { outputs[0] = new TensorC; outputs[1] = new TensorC; TopkParameter *parameter = new TopkParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->k_ = 6; int ret = TopKInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/transpose_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/transpose_infer_test.cc index 4d36b98caa..57d5c0a253 100644 --- a/mindspore/lite/test/ut/nnacl/infer/transpose_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/transpose_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(TransposeInferTest, TransposeInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; TransposeParameter *parameter = new TransposeParameter; - parameter->op_parameter_.infer_flag_ = true; // parameter->conjugate_ = false; parameter->perm_size_ = 4; parameter->perm_[0] = 2; diff --git a/mindspore/lite/test/ut/nnacl/infer/unique_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/unique_infer_test.cc index d2048aa658..0facfd6c48 100644 --- a/mindspore/lite/test/ut/nnacl/infer/unique_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/unique_infer_test.cc @@ -34,7 +34,6 @@ TEST_F(UniqueInferTest, UniqueInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = UniqueInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/unsorted_segment_sum_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/unsorted_segment_sum_infer_test.cc index 526f897599..9094cc25bd 100644 --- a/mindspore/lite/test/ut/nnacl/infer/unsorted_segment_sum_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/unsorted_segment_sum_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(UnsortedSegmentSumInferTest, UnsortedSegmentSumInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; UnsortedSegmentSumParameter *parameter = new UnsortedSegmentSumParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->segments_num_ = 10; int ret = UnsortedSegmentSumInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/unsqueeze_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/unsqueeze_infer_test.cc index 25122ce2dd..98ad4b3fb6 100644 --- a/mindspore/lite/test/ut/nnacl/infer/unsqueeze_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/unsqueeze_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(UnsqueezeInferTest, UnsqueezeInferTest0) { UnSqueezeParameter *parameter = new UnSqueezeParameter; parameter->num_dim_ = 1; parameter->dims_[0] = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = UnsqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -62,7 +61,6 @@ TEST_F(UnsqueezeInferTest, UnsqueezeInferTest1) { UnSqueezeParameter *parameter = new UnSqueezeParameter; parameter->num_dim_ = 1; parameter->dims_[0] = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = UnsqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -88,7 +86,6 @@ TEST_F(UnsqueezeInferTest, UnsqueezeInferTest2) { outputs[0] = new TensorC; UnSqueezeParameter *parameter = new UnSqueezeParameter; parameter->num_dim_ = 0; - parameter->op_parameter_.infer_flag_ = true; int ret = UnsqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -117,7 +114,6 @@ TEST_F(UnsqueezeInferTest, UnsqueezeInferTest3) { UnSqueezeParameter *parameter = new UnSqueezeParameter; parameter->num_dim_ = 1; parameter->dims_[0] = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = UnsqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -150,7 +146,6 @@ TEST_F(UnsqueezeInferTest, UnsqueezeInferTest4) { UnSqueezeParameter *parameter = new UnSqueezeParameter; parameter->num_dim_ = 1; parameter->dims_[0] = 1; - parameter->op_parameter_.infer_flag_ = true; int ret = UnsqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -183,7 +178,6 @@ TEST_F(UnsqueezeInferTest, UnsqueezeInferTest5) { UnSqueezeParameter *parameter = new UnSqueezeParameter; parameter->num_dim_ = 1; parameter->dims_[0] = 3; - parameter->op_parameter_.infer_flag_ = true; int ret = UnsqueezeInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/unstack_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/unstack_infer_test.cc index 754651ead6..ee31cae616 100644 --- a/mindspore/lite/test/ut/nnacl/infer/unstack_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/unstack_infer_test.cc @@ -35,7 +35,6 @@ TEST_F(UnstackInferTest, UnstackInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; UnstackParameter *parameter = new UnstackParameter; - parameter->op_parameter_.infer_flag_ = true; parameter->axis_ = 1; int ret = UnstackInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); diff --git a/mindspore/lite/test/ut/nnacl/infer/where_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/where_infer_test.cc index 35399b6780..39bfe729c7 100644 --- a/mindspore/lite/test/ut/nnacl/infer/where_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/where_infer_test.cc @@ -41,7 +41,6 @@ TEST_F(WhereInferTest, WhereInferTest0) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = WhereInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); @@ -72,7 +71,6 @@ TEST_F(WhereInferTest, WhereInferTest1) { std::vector outputs(1, NULL); outputs[0] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = WhereInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/nnacl/infer/while_infer_test.cc b/mindspore/lite/test/ut/nnacl/infer/while_infer_test.cc index f7dbda04dd..68acfba892 100644 --- a/mindspore/lite/test/ut/nnacl/infer/while_infer_test.cc +++ b/mindspore/lite/test/ut/nnacl/infer/while_infer_test.cc @@ -39,7 +39,6 @@ TEST_F(WhileInferTest, WhileInferTest0) { outputs[0] = new TensorC; outputs[1] = new TensorC; OpParameter *parameter = new OpParameter; - parameter->infer_flag_ = true; int ret = WhileInferShape((const TensorC **)inputs.data(), inputs.size(), outputs.data(), outputs.size(), reinterpret_cast(parameter)); ASSERT_EQ(ret, NNACL_OK); diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc index 7a70c96669..52d4eb1fa1 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc @@ -70,7 +70,6 @@ TEST_F(TestStridedSlice, StridedSlice) { std::vector outputs = {&out_tensor}; StridedSliceParameter *parameter = new StridedSliceParameter; parameter->op_parameter_.type_ = schema::PrimitiveType_StridedSlice; - parameter->op_parameter_.infer_flag_ = true; InitStridedSliceParam(parameter, &in_tensor, &begins_tensor, &ends_tensor, &strides_tensor); kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_StridedSlice}; auto creator = lite::KernelRegistry::GetInstance()->GetCreator(desc); @@ -113,7 +112,6 @@ TEST_F(TestStridedSlice, 7d) { std::vector outputs = {&out_tensor}; StridedSliceParameter *parameter = new StridedSliceParameter; parameter->op_parameter_.type_ = schema::PrimitiveType_StridedSlice; - parameter->op_parameter_.infer_flag_ = true; InitStridedSliceParam(parameter, &in_tensor, &begins_tensor, &ends_tensor, &strides_tensor); kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_StridedSlice}; auto creator = lite::KernelRegistry::GetInstance()->GetCreator(desc); @@ -156,7 +154,6 @@ TEST_F(TestStridedSlice, 8d) { std::vector outputs = {&out_tensor}; StridedSliceParameter *parameter = new StridedSliceParameter; parameter->op_parameter_.type_ = schema::PrimitiveType_StridedSlice; - parameter->op_parameter_.infer_flag_ = true; InitStridedSliceParam(parameter, &in_tensor, &begins_tensor, &ends_tensor, &strides_tensor); parameter->op_parameter_.type_ = schema::PrimitiveType_StridedSlice; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_StridedSlice}; @@ -201,7 +198,6 @@ TEST_F(TestStridedSlice, FastRun7d) { std::vector outputs = {&out_tensor}; StridedSliceParameter *parameter = new StridedSliceParameter; parameter->op_parameter_.type_ = schema::PrimitiveType_StridedSlice; - parameter->op_parameter_.infer_flag_ = true; InitStridedSliceParam(parameter, &in_tensor, &begins_tensor, &ends_tensor, &strides_tensor); kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_StridedSlice}; auto creator = lite::KernelRegistry::GetInstance()->GetCreator(desc); @@ -246,7 +242,6 @@ TEST_F(TestStridedSlice, FastRun7dSingleThread) { std::vector outputs = {&out_tensor}; StridedSliceParameter *parameter = new StridedSliceParameter; parameter->op_parameter_.type_ = schema::PrimitiveType_StridedSlice; - parameter->op_parameter_.infer_flag_ = true; InitStridedSliceParam(parameter, &in_tensor, &begins_tensor, &ends_tensor, &strides_tensor); kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_StridedSlice}; auto creator = lite::KernelRegistry::GetInstance()->GetCreator(desc); @@ -291,7 +286,6 @@ TEST_F(TestStridedSlice, StridedSliceInt8) { std::vector outputs = {&out_tensor}; StridedSliceParameter *parameter = new StridedSliceParameter; parameter->op_parameter_.type_ = schema::PrimitiveType_StridedSlice; - parameter->op_parameter_.infer_flag_ = true; InitStridedSliceParam(parameter, &in_tensor, &begins_tensor, &ends_tensor, &strides_tensor); parameter->op_parameter_.type_ = schema::PrimitiveType_StridedSlice; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_StridedSlice}; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/cumsum_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/cumsum_tests.cc index 08502bc92a..8d465f63ed 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/cumsum_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/cumsum_tests.cc @@ -41,7 +41,6 @@ TEST_F(TestCumsum, TestThread1) { CumSumParameter *parameter = reinterpret_cast(malloc(sizeof(CumSumParameter))); parameter->op_parameter_.type_ = schema::PrimitiveType_CumSum; - parameter->op_parameter_.infer_flag_ = true; parameter->exclusive_ = false; parameter->reverse_ = false; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_CumSum}; @@ -95,7 +94,6 @@ TEST_F(TestCumsum, TestExclusive) { CumSumParameter *parameter = reinterpret_cast(malloc(sizeof(CumSumParameter))); parameter->op_parameter_.type_ = schema::PrimitiveType_CumSum; - parameter->op_parameter_.infer_flag_ = true; parameter->exclusive_ = true; parameter->reverse_ = false; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_CumSum}; @@ -148,7 +146,6 @@ TEST_F(TestCumsum, TestReverse) { CumSumParameter *parameter = reinterpret_cast(malloc(sizeof(CumSumParameter))); parameter->op_parameter_.type_ = schema::PrimitiveType_CumSum; - parameter->op_parameter_.infer_flag_ = 1; parameter->exclusive_ = false; parameter->reverse_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_CumSum}; @@ -201,7 +198,6 @@ TEST_F(TestCumsum, TestReverseExclusive) { CumSumParameter *parameter = reinterpret_cast(malloc(sizeof(CumSumParameter))); parameter->op_parameter_.type_ = schema::PrimitiveType_CumSum; - parameter->op_parameter_.infer_flag_ = true; parameter->exclusive_ = true; parameter->reverse_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_CumSum}; @@ -254,7 +250,6 @@ TEST_F(TestCumsum, TestIntRank2) { CumSumParameter *parameter = reinterpret_cast(malloc(sizeof(CumSumParameter))); parameter->op_parameter_.type_ = schema::PrimitiveType_CumSum; - parameter->op_parameter_.infer_flag_ = true; parameter->exclusive_ = false; parameter->reverse_ = false; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_CumSum}; @@ -302,7 +297,6 @@ TEST_F(TestCumsum, TestIntRank2Thread2) { CumSumParameter *parameter = reinterpret_cast(malloc(sizeof(CumSumParameter))); parameter->op_parameter_.type_ = schema::PrimitiveType_CumSum; - parameter->op_parameter_.infer_flag_ = true; parameter->exclusive_ = false; parameter->reverse_ = false; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_CumSum}; @@ -349,7 +343,6 @@ TEST_F(TestCumsum, TestIntRank2Thread4) { CumSumParameter *parameter = reinterpret_cast(malloc(sizeof(CumSumParameter))); parameter->op_parameter_.type_ = schema::PrimitiveType_CumSum; - parameter->op_parameter_.infer_flag_ = true; parameter->exclusive_ = false; parameter->reverse_ = false; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeFloat32, schema::PrimitiveType_CumSum}; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc index 4c703da6d6..29996ed5fb 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc @@ -69,7 +69,6 @@ int FcTestInit1(std::vector *inputs_, std::vectorhas_bias_ = true; matmal_param->act_type_ = ActType_No; matmal_param->op_parameter_.type_ = 67; - matmal_param->op_parameter_.infer_flag_ = true; KernelInferShape(*inputs_, outputs_, reinterpret_cast(matmal_param)); return out_t->ElementsNum(); } @@ -129,7 +128,6 @@ int FcTestInit2(std::vector *inputs_, std::vectorhas_bias_ = true; matmal_param->act_type_ = ActType_No; matmal_param->op_parameter_.type_ = 67; - matmal_param->op_parameter_.infer_flag_ = true; KernelInferShape(*inputs_, outputs_, reinterpret_cast(matmal_param)); return out_t->ElementsNum(); } diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/transpose_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/transpose_fp32_tests.cc index ce014b1c96..1841af8f78 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/transpose_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/transpose_fp32_tests.cc @@ -45,7 +45,6 @@ TEST_F(TestTransposeFp32, 10D) { MS_LOG(ERROR) << "New param fails."; return; } - param->op_parameter_.infer_flag_ = true; param->op_parameter_.type_ = schema::PrimitiveType_Transpose; std::vector inputs = {&in_tensor, &perm_tensor}; std::vector outputs = {&out_tensor}; @@ -84,7 +83,6 @@ TEST_F(TestTransposeFp32, 10DSingleThread) { MS_LOG(ERROR) << "New param fails."; return; } - param->op_parameter_.infer_flag_ = true; param->op_parameter_.type_ = schema::PrimitiveType_Transpose; std::vector inputs = {&in_tensor, &perm_tensor}; std::vector outputs = {&out_tensor}; @@ -218,7 +216,6 @@ TEST_F(TestTransposeFp32, TransposeFp32_test5) { /* 1x2x3x2x2 */ std::vector output_shape = {2, 2, 3, 2, 1}; int perm[5] = {4, 3, 2, 1, 0}; TransposeParameter *param = new (std::nothrow) TransposeParameter; - param->op_parameter_.infer_flag_ = true; param->op_parameter_.type_ = schema::PrimitiveType_Transpose; lite::Tensor input_tensor; input_tensor.set_data(input.data()); diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/slice_int8_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/slice_int8_tests.cc index 7b51450f1d..d73466114d 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/slice_int8_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/slice_int8_tests.cc @@ -52,7 +52,6 @@ TEST_F(TestSliceInt8, SliceInt8) { std::vector outputs = {&out_tensor}; SliceParameter *parameter = new (std::nothrow) SliceParameter; - parameter->op_parameter_.infer_flag_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_SliceFusion}; @@ -103,7 +102,6 @@ TEST_F(TestSliceInt8, Slice5D) { std::vector outputs = {&out_tensor}; SliceParameter *parameter = new (std::nothrow) SliceParameter; - parameter->op_parameter_.infer_flag_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_SliceFusion}; @@ -154,7 +152,6 @@ TEST_F(TestSliceInt8, Slice6D) { std::vector outputs = {&out_tensor}; SliceParameter *parameter = new (std::nothrow) SliceParameter; - parameter->op_parameter_.infer_flag_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_SliceFusion}; @@ -205,7 +202,6 @@ TEST_F(TestSliceInt8, Slice7D) { std::vector outputs = {&out_tensor}; SliceParameter *parameter = new (std::nothrow) SliceParameter; - parameter->op_parameter_.infer_flag_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_SliceFusion}; @@ -257,7 +253,6 @@ TEST_F(TestSliceInt8, Slice8D) { std::vector outputs = {&out_tensor}; SliceParameter *parameter = new (std::nothrow) SliceParameter; - parameter->op_parameter_.infer_flag_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_SliceFusion}; @@ -309,7 +304,6 @@ TEST_F(TestSliceInt8, SliceDiffQuantArgs) { std::vector outputs = {&out_tensor}; SliceParameter *parameter = new (std::nothrow) SliceParameter; - parameter->op_parameter_.infer_flag_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_SliceFusion}; @@ -361,7 +355,6 @@ TEST_F(TestSliceInt8, SliceSingleThread) { std::vector outputs = {&out_tensor}; SliceParameter *parameter = new (std::nothrow) SliceParameter; - parameter->op_parameter_.infer_flag_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_SliceFusion}; @@ -415,7 +408,6 @@ TEST_F(TestSliceInt8, Slice4Thread) { std::vector outputs = {&out_tensor}; SliceParameter *parameter = new (std::nothrow) SliceParameter; - parameter->op_parameter_.infer_flag_ = true; kernel::KernelKey desc = {kernel::KERNEL_ARCH::kCPU, kNumberTypeInt8, schema::PrimitiveType_SliceFusion}; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/opencl/argminmax_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/opencl/argminmax_tests.cc index ad897773c7..7a06db10b0 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/opencl/argminmax_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/opencl/argminmax_tests.cc @@ -31,7 +31,6 @@ OpParameter *CreateParameter(schema::PrimitiveType type, int axis, int topk, boo param->axis_type_ = axis_type; param->out_value_ = out_value; param->keep_dims_ = keep_dims; - reinterpret_cast(param)->infer_flag_ = true; return reinterpret_cast(param); } } // namespace diff --git a/mindspore/lite/test/ut/src/runtime/kernel/opencl/strided_slice_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/opencl/strided_slice_tests.cc index 3a3b244cbd..bd6b3d48d1 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/opencl/strided_slice_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/opencl/strided_slice_tests.cc @@ -406,7 +406,6 @@ TEST_F(TestOpenCL_StridedSlice, test0) { for (auto fp16_enable : {false, true}) { auto *param = CreateParameter(begin, end, stride); - param->infer_flag_ = true; TestMain({{input_shape, input_data, VAR, kNumberTypeFloat32}, {{static_cast(begin.size())}, begin.data(), CONST_TENSOR, kNumberTypeInt32}, {{static_cast(end.size())}, end.data(), CONST_TENSOR, kNumberTypeInt32}, diff --git a/mindspore/lite/tools/common/node_util.cc b/mindspore/lite/tools/common/node_util.cc index 4930d828ec..02720b7696 100644 --- a/mindspore/lite/tools/common/node_util.cc +++ b/mindspore/lite/tools/common/node_util.cc @@ -375,7 +375,6 @@ STATUS NodeInferShpae(const schema::CNodeT &node, const std::vector &i MS_LOG(ERROR) << "parameter is nullptr."; return RET_ERROR; } - parameter->infer_flag_ = true; auto ret = KernelInferShape(inputs, outputs, parameter); fbb.Clear(); free(parameter); diff --git a/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.cc b/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.cc index 0ef9d85a1e..f450b79645 100644 --- a/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.cc +++ b/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.cc @@ -168,7 +168,7 @@ std::vector ConvertTensorToLiteTensor(MetaGraphT *graph, const std::ve } STATUS NodeInferShape(const std::unique_ptr &node, const std::vector &inputs, - std::vector *outputs, bool infer_interrupt) { + std::vector *outputs) { flatbuffers::FlatBufferBuilder fbb(kInitialSize); auto prim = ConvertToPrimitive(node->primitive.get(), &fbb); if (prim == nullptr) { @@ -189,11 +189,6 @@ STATUS NodeInferShape(const std::unique_ptr &node, const std::ve return RET_ERROR; } parameter->quant_type_ = node->quantType; - if (infer_interrupt) { - parameter->infer_flag_ = false; - } else { - parameter->infer_flag_ = true; - } auto ret = KernelInferShape(inputs, outputs, parameter); fbb.Clear(); free(parameter); @@ -257,10 +252,6 @@ STATUS InferShapePass::Run(MetaGraphT *graph) { dim = DEFAULT_DIM_VALUE; } } - auto input_shape = graph->allTensors.at(input_idx)->dims; - if (std::find(input_shape.begin(), input_shape.end(), -1) != input_shape.end() || fmk_type_ == FmkType_TF) { - infer_interrupt_ = true; - } } while (!infer_node_indexes_.empty()) { auto infer_node_index = infer_node_indexes_.front(); @@ -282,9 +273,9 @@ STATUS InferShapePass::Run(MetaGraphT *graph) { FreeTensors(&input_tensors, &output_tensors); return RET_INFER_ERR; } - auto status = NodeInferShape(node, input_tensors, &output_tensors, infer_interrupt_); + auto status = NodeInferShape(node, input_tensors, &output_tensors); MS_LOG(DEBUG) << "cur node:" << node->name; - if (status == RET_OK) { + if (status == RET_OK || status == RET_INFER_INVALID) { #ifdef Debug PrintTensorShape(input_tensors, output_tensors); #endif @@ -295,11 +286,6 @@ STATUS InferShapePass::Run(MetaGraphT *graph) { output_tensor->dims.swap(output_dims); SetDataType(graph, output_tensors, &tensors_, i, infer_node_index); } - } else if (status == RET_INFER_INVALID) { - for (size_t i = 0; i < output_tensors.size(); i++) { - SetDataType(graph, output_tensors, &tensors_, i, infer_node_index); - } - infer_interrupt_ = true; } else { MS_LOG(WARNING) << "InferShape failed, name: " << node->name << ", type: " << schema::EnumNamePrimitiveType(node->primitive->value.type); @@ -309,6 +295,7 @@ STATUS InferShapePass::Run(MetaGraphT *graph) { FreeTensors(&input_tensors, &output_tensors); AddOutputNodes(graph, infer_node_index); } + ResetIncorrectTensorShape(graph); return RET_OK; } @@ -378,5 +365,17 @@ void InferShapePass::AddNextInferShapeNode(MetaGraphT *graph, std::vectornodes) { + auto out_tensors_index = node->outputIndex; + for (auto index : out_tensors_index) { + auto shape = graph->allTensors.at(index)->dims; + if (shape == std::vector{-1}) { + graph->allTensors.at(index)->dims = {}; + } + } + } +} } // namespace lite } // namespace mindspore diff --git a/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.h b/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.h index 491d5644c5..91723074c9 100644 --- a/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.h +++ b/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.h @@ -47,11 +47,11 @@ class InferShapePass : public GraphPass { void InitSearchTensor(MetaGraphT *graph); void AddNextInferShapeNode(MetaGraphT *graph, std::vector next_nodes_indexes, size_t index); void AddOutputNodes(MetaGraphT *graph, uint32_t infer_node_index); + void ResetIncorrectTensorShape(MetaGraphT *graph); lite::converter::FmkType fmk_type_ = FmkType_TF; std::vector tensors_ = {}; std::vector infer_node_indexes_ = {}; - bool infer_interrupt_ = false; }; } // namespace lite } // namespace mindspore diff --git a/mindspore/lite/tools/optimizer/fusion/constant_folding_fusion.cc b/mindspore/lite/tools/optimizer/fusion/constant_folding_fusion.cc index ccce8215d5..ae9b644fd4 100644 --- a/mindspore/lite/tools/optimizer/fusion/constant_folding_fusion.cc +++ b/mindspore/lite/tools/optimizer/fusion/constant_folding_fusion.cc @@ -165,7 +165,6 @@ kernel::LiteKernel *GetLiteKernel(std::vector inputs, std::vectorinfer_flag_ = true; auto ret = KernelInferShape(inputs, outputs, parameter); if (ret != lite::RET_OK) { free(parameter); diff --git a/mindspore/lite/tools/optimizer/graph/infershape_pass.cc b/mindspore/lite/tools/optimizer/graph/infershape_pass.cc index afa7b8de4c..c0ff136820 100644 --- a/mindspore/lite/tools/optimizer/graph/infershape_pass.cc +++ b/mindspore/lite/tools/optimizer/graph/infershape_pass.cc @@ -426,7 +426,6 @@ bool InferShapePass::Run(const FuncGraphPtr &func_graph) { fbb.Clear(); return false; } - parameter->infer_flag_ = true; status = KernelInferShape(input_tensors, &output_tensors, parameter); if (status == RET_OK) { status = SetCNodeAbstract(output_tensors, cnode); diff --git a/mindspore/lite/tools/optimizer/graph/node_infershape.cc b/mindspore/lite/tools/optimizer/graph/node_infershape.cc index ff23feb0c1..e587ab86ab 100644 --- a/mindspore/lite/tools/optimizer/graph/node_infershape.cc +++ b/mindspore/lite/tools/optimizer/graph/node_infershape.cc @@ -55,46 +55,17 @@ void SetConvWeightFormat(const CNodePtr &cnode, const std::vector &inputs, FmkType fmk_type) { +void RectifyFormat(const CNodePtr &cnode, const std::vector &inputs, FmkType fmk_type) { MS_ASSERT(cnode != nullptr); + if (fmk_type != lite::converter::FmkType_ONNX) { + return; + } for (auto &input : inputs) { auto shape = input->shape(); - if (std::find(shape.begin(), shape.end(), -1) != shape.end()) { - if (fmk_type == lite::converter::FmkType_ONNX && shape.size() == 4 && shape[3] == 3 && shape[1] == -1) { - input->set_format(schema::Format_NHWC); - } - return false; - } - } - auto origin_inputs = cnode->inputs(); - lite::RemoveIfDepend(cnode); - lite::RemoveIfMakeTuple(cnode); - for (size_t i = 1; i < cnode->size(); ++i) { - if (!utils::isa(cnode->input(i))) { - continue; - } - auto input_cnode = cnode->input(i)->cast(); - if (CheckPrimitiveType(cnode->input(i), prim::kPrimTupleGetItem)) { - input_cnode = input_cnode->input(1)->cast(); - } - if (input_cnode == nullptr) { - MS_LOG(ERROR) << "input is not cnode."; - cnode->set_inputs(origin_inputs); - return false; - } - auto prim = GetValueNode(input_cnode->input(0)); - if (prim == nullptr || prim->GetAttr(kInferDone) == nullptr) { - MS_LOG(ERROR) << "prim is invalid."; - cnode->set_inputs(origin_inputs); - return false; - } - if (!GetValue(prim->GetAttr(kInferDone))) { - cnode->set_inputs(origin_inputs); - return false; + if (shape.size() == 4 && shape[3] == 3 && shape[1] == -1) { + input->set_format(schema::Format_NHWC); } } - cnode->set_inputs(origin_inputs); - return true; } tensor::TensorPtr NewTensorInfo(lite::Tensor *tensor) { @@ -178,13 +149,13 @@ STATUS NodeInferShape::InferShape(const CNodePtr &cnode) { fbb.Clear(); return lite::RET_ERROR; } - parameter->infer_flag_ = DuceInferFlag(cnode, inputs, fmk_type_); + RectifyFormat(cnode, inputs, fmk_type_); auto status = KernelInferShape(inputs, &outputs, parameter); if (status == lite::RET_OK) { anf_prim->AddAttr(kInferDone, MakeValue(true)); } if (status == lite::RET_OK || status == lite::RET_INFER_INVALID) { - auto set_status = SetCNodeAbstract(cnode, outputs); + auto set_status = SetCNodeAbstract(cnode, outputs, status); if (set_status != lite::RET_OK) { MS_LOG(ERROR) << "set CNode abstract failed: " << cnode->fullname_with_scope(); return set_status; @@ -204,18 +175,30 @@ std::vector NodeInferShape::GetInputShape(const CNodePtr &cnode, size_t ind if (index >= cnode->size()) { return {}; } - auto origin_inputs = cnode->inputs(); - std::vector specify_inputs = {origin_inputs[0], origin_inputs[index]}; - cnode->set_inputs(specify_inputs); - std::vector specify_tensors; - if (GetCNodeInputTensors(cnode, &specify_tensors) != lite::RET_OK || specify_tensors.empty()) { - cnode->set_inputs(origin_inputs); + lite::DataInfo data_info; + int status = lite::RET_OK; + CNodePtr base_node = cnode; + size_t position = index; + if (CheckPrimitiveType(cnode->input(index), prim::kPrimMakeTuple) || + CheckPrimitiveType(cnode->input(index), kPrimMakeTupleV2)) { + base_node = cnode->input(index)->cast(); + position = 1; + } + if (utils::isa(base_node->input(position))) { + status = lite::FetchDataFromCNode(base_node, position, fmk_type_, train_flag_, &data_info); + } else if (utils::isa(base_node->input(position))) { + status = lite::FetchDataFromParameterNode(base_node, position, fmk_type_, train_flag_, &data_info); + } else if (utils::isa(base_node->input(position))) { + status = lite::FetchDataFromValueNode(base_node, position, fmk_type_, train_flag_, &data_info); + } else { + MS_LOG(ERROR) << "input node is invalid."; return {}; } - cnode->set_inputs(origin_inputs); - auto shape = specify_tensors.front()->shape(); - FreeTensors(&specify_tensors); - return shape; + if (status != lite::RET_OK && status != lite::RET_NO_CHANGE) { + MS_LOG(ERROR) << "fetch data failed."; + return {}; + } + return data_info.shape_; } std::vector NodeInferShape::GetIntVecInput(const CNodePtr &cnode, size_t index) { @@ -349,6 +332,17 @@ STATUS NodeInferShape::GetCNodeVarInput(const CNodePtr &cnode, std::vectorinput(i)->cast(); + PrimitivePtr input_prim = GetValueNode(input_cnode->input(0)); + if (CheckPrimitiveType(input_cnode, prim::kPrimTupleGetItem)) { + auto item_input_cnode = input_cnode->input(1)->cast(); + MS_ASSERT(item_input_cnode != nullptr); + input_prim = GetValueNode(item_input_cnode->input(0)); + } + MS_ASSERT(input_prim != nullptr); + if (input_prim->GetAttr(kInferDone) == nullptr || !GetValue(input_prim->GetAttr(kInferDone))) { + tensor->set_shape({-1}); + } var_ms_inputs->emplace_back(tensor); } return lite::RET_OK; @@ -471,8 +465,8 @@ STATUS NodeInferShape::ConvertToLiteTensor(const std::vector &da return lite::RET_OK; } -STATUS NodeInferShape::SetCNodeAbstract(const std::shared_ptr &cnode, - const std::vector &outputs) { +STATUS NodeInferShape::SetCNodeAbstract(const std::shared_ptr &cnode, const std::vector &outputs, + int status) { MS_ASSERT(cnode != nullptr); if (outputs.size() == 0) { MS_LOG(ERROR) << "empty output_tensors"; @@ -483,8 +477,16 @@ STATUS NodeInferShape::SetCNodeAbstract(const std::shared_ptr &cnode, auto tensor = outputs.front(); auto new_abstract = ConvertLiteTensorToAbstract(tensor); if (new_abstract == nullptr) { + MS_LOG(ERROR) << "new abstract failed."; return RET_ERROR; } + if (status == lite::RET_INFER_INVALID) { + ShapeVector shape; + if (tensor->data_type() == kObjectTypeTensorType) { + shape = {0}; + } + new_abstract->set_shape(std::make_shared(shape)); + } cnode->set_abstract(new_abstract); } else { AbstractBasePtrList abstract_list; @@ -492,8 +494,16 @@ STATUS NodeInferShape::SetCNodeAbstract(const std::shared_ptr &cnode, auto tensor = outputs.at(i); auto new_abstract = ConvertLiteTensorToAbstract(tensor); if (new_abstract == nullptr) { + MS_LOG(ERROR) << "new abstract failed."; return RET_ERROR; } + if (status == lite::RET_INFER_INVALID) { + ShapeVector shape; + if (tensor->data_type() == kObjectTypeTensorType) { + shape = {0}; + } + new_abstract->set_shape(std::make_shared(shape)); + } abstract_list.emplace_back(new_abstract); } cnode->set_abstract(std::make_shared(abstract_list)); diff --git a/mindspore/lite/tools/optimizer/graph/node_infershape.h b/mindspore/lite/tools/optimizer/graph/node_infershape.h index 8c73db960b..f65cab79e1 100644 --- a/mindspore/lite/tools/optimizer/graph/node_infershape.h +++ b/mindspore/lite/tools/optimizer/graph/node_infershape.h @@ -49,7 +49,7 @@ class NodeInferShape { lite::Tensor *GetCNodeTensorListVarInput(const lite::DataInfo &data_info); STATUS GetCNodeOutputTensors(const CNodePtr &cnode, std::vector *outputs); STATUS ConvertToLiteTensor(const std::vector &data_infos, std::vector *tensors); - STATUS SetCNodeAbstract(const std::shared_ptr &cnode, const std::vector &outputs); + STATUS SetCNodeAbstract(const std::shared_ptr &cnode, const std::vector &outputs, int status); abstract::AbstractBasePtr ConvertLiteTensorToAbstract(lite::Tensor *tensor); abstract::AbstractBasePtr ConvertTensorListToAbstract(lite::Tensor *tensor); FmkType fmk_type_{lite::converter::FmkType_MS};