未验证 提交 c5cc687c 编写于 作者: 石晓伟 提交者: GitHub

add clear_blocks interface for flatbuffers view, test=develop (#4362)

* add clear_blocks interface for flatbuffers view, test=develop

* fix a bug, test=develop

* enhanced the error messages, test=develop
上级 1a6880d6
......@@ -79,6 +79,13 @@ class ProgramDescView : public ProgramDescAPI {
return desc_->version()->version();
}
void ClearBlocks() override {
CHECK_EQ(BlocksSize(), 0u) << "For backward compatibility, in the "
"read-only flatbuffers version, this "
"interface degenerates to force the number "
"of blocks to be zero.";
}
proto::ProgramDesc const* raw_desc() const { return desc_; }
const std::vector<char>& buf() const { return buf_; }
......
......@@ -1000,14 +1000,17 @@ void LoadModelNaiveFromMemory(const std::string &model_buffer,
#ifndef LITE_ON_TINY_PUBLISH
LoadModelNaiveV0FromMemory(model_buffer, scope, cpp_prog);
#else
LOG(FATAL) << "Error: Unsupported model type.";
LOG(FATAL) << "Paddle-Lite v2.7 has upgraded the naive-buffer model "
"format. Please use the OPT to generate a new model. "
"Thanks!";
#endif
break;
case 1:
LoadModelNaiveV1FromMemory(model_buffer, scope, cpp_prog);
break;
default:
LOG(FATAL) << "Error: Unsupported model type.";
LOG(FATAL) << "The model format cannot be recognized. Please make sure "
"you use the correct interface and model file.";
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册