forked from mindspore-Ecosystem/mindspore
!5479 fix reshape and l2norm tflite parser bug
Merge pull request !5479 from lyvette/master
This commit is contained in:
commit
3c5196152a
|
@ -51,7 +51,6 @@ STATUS TfliteActivationParser::Parse(const std::unique_ptr<tflite::OperatorT> &t
|
|||
if (std::strcmp(node_name, "Relu") == 0) {
|
||||
MS_LOG(DEBUG) << "parse TfliteReluParser";
|
||||
attr->type = schema::ActivationType_RELU;
|
||||
|
||||
} else if (std::strcmp(node_name, "Relu6") == 0) {
|
||||
MS_LOG(DEBUG) << "parse TfliteRelu6Parser";
|
||||
attr->type = schema::ActivationType_RELU6;
|
||||
|
|
|
@ -51,10 +51,6 @@ STATUS TfliteL2NormParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflit
|
|||
return RET_NULL_PTR;
|
||||
}
|
||||
auto data_index = tflite_op->inputs[0];
|
||||
if (static_cast<int>(tflite_op->inputs.size()) <= data_index) {
|
||||
MS_LOG(ERROR) << "the size of input should be greater than " << data_index;
|
||||
return RET_ERROR;
|
||||
}
|
||||
const auto &data_tensor = tflite_tensors[data_index];
|
||||
if (data_tensor == nullptr) {
|
||||
MS_LOG(ERROR) << "the input tensor is null";
|
||||
|
|
|
@ -57,9 +57,16 @@ STATUS TfliteReshapeParser::Parse(const std::unique_ptr<tflite::OperatorT> &tfli
|
|||
MS_LOG(ERROR) << "shape_tensor is null";
|
||||
return RET_NULL_PTR;
|
||||
}
|
||||
if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->shape)) {
|
||||
MS_LOG(ERROR) << "get reshape -> shape failed";
|
||||
return RET_ERROR;
|
||||
auto &buf_data = tflite_model_buffer[shape_tensor->buffer];
|
||||
if (buf_data == nullptr) {
|
||||
MS_LOG(ERROR) << "buf_data is null";
|
||||
return RET_NULL_PTR;
|
||||
}
|
||||
if (!buf_data->data.empty()) {
|
||||
if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->shape)) {
|
||||
MS_LOG(ERROR) << "get reshape -> shape failed";
|
||||
return RET_ERROR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
attr->format = schema::Format_NHWC;
|
||||
|
|
Loading…
Reference in New Issue