From 7aeeed7e4daf80ccba8ce8aeb0893ecfd2f9b91e Mon Sep 17 00:00:00 2001 From: zengxianglong Date: Wed, 24 Mar 2021 19:45:42 +0800 Subject: [PATCH] fix a bug of the fc op in the fp16 subgraph and add models to the entrance guard --- mindspore/lite/src/lite_kernel.cc | 3 +++ mindspore/lite/test/models_tflite_fp16.cfg | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/mindspore/lite/src/lite_kernel.cc b/mindspore/lite/src/lite_kernel.cc index e2ae540cad..25f1ac14d7 100644 --- a/mindspore/lite/src/lite_kernel.cc +++ b/mindspore/lite/src/lite_kernel.cc @@ -105,6 +105,9 @@ int LiteKernel::PreProcess() { for (auto *output : this->out_tensors()) { MS_ASSERT(output != nullptr); + if (desc_.data_type == kNumberTypeFloat16 && output->data_type() == kNumberTypeFloat32) { + output->set_data_type(kNumberTypeFloat16); + } if (output->ElementsNum() >= MAX_MALLOC_SIZE / static_cast(sizeof(int64_t))) { MS_LOG(ERROR) << "The size of output tensor is too big"; return RET_ERROR; diff --git a/mindspore/lite/test/models_tflite_fp16.cfg b/mindspore/lite/test/models_tflite_fp16.cfg index a824753fe4..562d4d73de 100644 --- a/mindspore/lite/test/models_tflite_fp16.cfg +++ b/mindspore/lite/test/models_tflite_fp16.cfg @@ -149,3 +149,11 @@ scan_hms_detect_pb2tflite.tflite 1.5 ml_location.tflite 0.5 ml_face_openclose_tflite.tflite 0.5 ml_object_detect_pb2tflite.tflite 1.5 +# lite-model_on_device_vision_classifier_landmarks_classifier* models' bias are caused by error accumulation and small +# output value +lite-model_on_device_vision_classifier_landmarks_classifier_africa_V1_1.tflite 10 +lite-model_on_device_vision_classifier_landmarks_classifier_north_america_V1_1.tflite 18 +lite-model_on_device_vision_classifier_landmarks_classifier_asia_V1_1.tflite 25 +lite-model_on_device_vision_classifier_landmarks_classifier_oceania_antarctica_V1_1.tflite 10 +lite-model_on_device_vision_classifier_landmarks_classifier_europe_V1_1.tflite 32 +lite-model_on_device_vision_classifier_landmarks_classifier_south_america_V1_1.tflite 14