提交 09142f60 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!5798 [MSLITE]schema add version and fix the version function bug

Merge pull request !5798 from zhaodezan/master
......@@ -571,9 +571,9 @@ build_minddata_lite_deps()
build_lite()
{
VERSION_MAJOR=`grep "#define MS_VERSION_MAJOR" mindspore/lite/include/version.h | tr -dc "[0-9]"`
VERSION_MINOR=`grep "#define MS_VERSION_MINOR" mindspore/lite/include/version.h | tr -dc "[0-9]"`
VERSION_REVISION=`grep "#define MS_VERSION_REVISION" mindspore/lite/include/version.h | tr -dc "[0-9]"`
VERSION_MAJOR=`grep "const int ms_version_major =" mindspore/lite/include/version.h | tr -dc "[0-9]"`
VERSION_MINOR=`grep "const int ms_version_minor =" mindspore/lite/include/version.h | tr -dc "[0-9]"`
VERSION_REVISION=`grep "const int ms_version_revision =" mindspore/lite/include/version.h | tr -dc "[0-9]"`
echo "============ Start building MindSpore Lite ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} ============"
if [ "${ENABLE_GPU}" == "on" ] && [ "${LITE_PLATFORM}" == "arm64" ]; then
echo "start build opencl"
......
......@@ -21,16 +21,16 @@
namespace mindspore {
namespace lite {
#define MS_VERSION_MAJOR 0
#define MS_VERSION_MINOR 7
#define MS_VERSION_REVISION 0
const int ms_version_major = 0;
const int ms_version_minor = 7;
const int ms_version_revision = 0;
/// \brief Global method to get a version string.
///
/// \return The version string of MindSpore Lite.
std::string Version() {
return "MindSpore Lite " + std::to_string(MS_VERSION_MAJOR) + "." + std::to_string(MS_VERSION_MINOR) + "." +
std::to_string(MS_VERSION_REVISION);
inline std::string Version() {
return "MindSpore Lite " + std::to_string(ms_version_major) + "." + std::to_string(ms_version_minor) + "." +
std::to_string(ms_version_revision);
}
} // namespace lite
} // namespace mindspore
......
......@@ -219,6 +219,7 @@ table CNode {
table MetaGraph {
name: string;
version: string;
fmkType: int; // 0:tf,1:caffe
inputIndex: [uint];
outputIndex: [uint];
......
......@@ -24,6 +24,7 @@
#include "include/ms_tensor.h"
#include "include/context.h"
#include "src/runtime/runtime_api.h"
#include "include/version.h"
namespace mindspore {
namespace lite {
......@@ -352,6 +353,10 @@ int Benchmark::RunBenchmark(const std::string &deviceType) {
return RET_ERROR;
}
auto model = lite::Model::Import(graphBuf, size);
auto model_version = model->GetMetaGraph()->version()->str();
if (model_version != Version()) {
MS_LOG(WARNING) << "model version is "<< model_version << ", inference version is " << Version() << " not equal";
}
if (model == nullptr) {
MS_LOG(ERROR) << "Import model file failed while running " << modelName.c_str();
std::cerr << "Import model file failed while running " << modelName.c_str() << std::endl;
......
......@@ -33,6 +33,7 @@
#include "tools/converter/parser/onnx/onnx.pb.h"
#include "tools/converter/quantizer/post_training_quantizer.h"
#include "tools/converter/quantizer/quant_cast.h"
#include "include/version.h"
namespace mindspore {
namespace lite {
......@@ -154,6 +155,7 @@ int RunConverter(int argc, const char **argv) {
// save graph to file
Storage storage;
fb_graph->version = Version();
status = storage.Save(*fb_graph, flags->outputFile);
if (status != 0) {
MS_LOG(ERROR) << "Save graph failed";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册