Browse Source

fix caffe unsupported op print and multiple inputs

tags/v1.1.0
xuanyue 5 years ago
parent
commit
0ebd45b2cd
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      mindspore/lite/tools/converter/parser/caffe/caffe_model_parser.cc

+ 11
- 4
mindspore/lite/tools/converter/parser/caffe/caffe_model_parser.cc View File

@@ -248,7 +248,7 @@ STATUS CaffeModelParser::ParseLayer(const caffe::NetParameter &proto, const caff
} else {
MS_LOG(ERROR) << "Parse weight for " << layer.name() << " Failed!";
}
status = (status == RET_OK ? RET_NOT_FIND_OP : status);
status = (status == RET_OK ? status_node : status);
continue;
}

@@ -263,7 +263,7 @@ STATUS CaffeModelParser::ParseLayer(const caffe::NetParameter &proto, const caff
if (status_node != RET_OK) {
interrupt = true;
MS_LOG(ERROR) << "Set Op " << layer.name() << " Output Index Failed!";
status = (status == RET_OK ? RET_NOT_FIND_OP : status);
status = (status == RET_OK ? status_node : status);
continue;
}

@@ -280,8 +280,15 @@ STATUS CaffeModelParser::GetModelInput(const caffe::NetParameter &proto, TensorC
continue;
}
std::unique_ptr<schema::TensorT> msTensor = std::make_unique<schema::TensorT>();
for (int j = 0; j < proto.input_dim_size(); j++) {
msTensor->dims.push_back(proto.input_dim(j));
if (proto.input_dim_size() > 4) {
int step = proto.input_dim_size() / proto.input_size();
for (int j = i * step; j < (i + 1) * step; j++) {
msTensor->dims.push_back(proto.input_dim(j));
}
} else {
for (int j = 0; j < proto.input_dim_size(); j++) {
msTensor->dims.push_back(proto.input_dim(j));
}
}
msTensor->refCount = schema::NodeType::NodeType_ValueNode;
msTensor->dataType = kNumberTypeFloat32;


Loading…
Cancel
Save