Browse Source

!4975 Fix bug and add tflite models

Merge pull request !4975 from jianghui/master
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
8219df7337
3 changed files with 5 additions and 3 deletions
  1. +2
    -2
      mindspore/lite/test/models_tflite.cfg
  2. +2
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc
  3. +1
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h

+ 2
- 2
mindspore/lite/test/models_tflite.cfg View File

@@ -78,9 +78,9 @@ hiai_cv_labelDetectorModel_v2.tflite
#hiai_cv_labelDetectorModel_v3.tflite
hiai_cv_labelDetectorModel_v4.tflite
hiai_dress_detect.tflite
#hiai_frozen_inference_graph.tflite
hiai_frozen_inference_graph.tflite
hiai_ghostnet.tflite
hiai_iMaxDN_RGB.tflite
hiai_iMaxSR_RGB.tflite
hiai_label_and_video.tflite
#hiai_lm_inference_graph.tflite
hiai_lm_inference_graph.tflite

+ 2
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc View File

@@ -158,7 +158,7 @@ STATUS TfliteModelParser::ConvertTensor(const std::unique_ptr<tflite::SubGraphT>
auto isConst = (!tensor_buffer->data.empty());
if (isConst) {
CopyConstTensorData(tflite_model_buffer, tflite_tensor.get(), tensor.get());
} else if (tensor->dataType == TypeId::kNumberTypeUInt8) {
} else if (quantType == QuantType_AwareTraining && tensor->dataType == TypeId::kNumberTypeUInt8) {
// set in/out tensor to int8 to fit ms-lite op
tensor->dataType = TypeId::kNumberTypeInt8;
}
@@ -299,6 +299,7 @@ MetaGraphT *TfliteModelParser::Parse(const std::string &model_file,
const QuantType &quant_type) {
std::unique_ptr<schema::MetaGraphT> sub_graph = std::make_unique<schema::MetaGraphT>();
sub_graph->name = "MS_model converted by TF-Lite";
quantType = quant_type;

// load graph
std::unique_ptr<tflite::ModelT> tflite_model = ReadTfliteModel(model_file.c_str());


+ 1
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h View File

@@ -77,6 +77,7 @@ class TfliteModelParser : public ModelParser {

std::map<std::string, schema::CNodeT *> opMap;
std::map<const tflite::OperatorT *, schema::CNodeT *> tfliteOpMap;
QuantType quantType = QuantType_QUANT_NONE;
};
} // namespace lite
} // namespace mindspore


Loading…
Cancel
Save