schema add version

This commit is contained in:
zhaodezan 2020-09-05 00:25:26 -04:00
parent 5ef6c08260
commit b6493c209f
5 changed files with 17 additions and 9 deletions

View File

@ -571,9 +571,9 @@ build_minddata_lite_deps()
build_lite() build_lite()
{ {
VERSION_MAJOR=`grep "#define MS_VERSION_MAJOR" 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 "#define MS_VERSION_MINOR" 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 "#define MS_VERSION_REVISION" 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} ============" echo "============ Start building MindSpore Lite ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} ============"
if [ "${ENABLE_GPU}" == "on" ] && [ "${LITE_PLATFORM}" == "arm64" ]; then if [ "${ENABLE_GPU}" == "on" ] && [ "${LITE_PLATFORM}" == "arm64" ]; then
echo "start build opencl" echo "start build opencl"

View File

@ -21,16 +21,16 @@
namespace mindspore { namespace mindspore {
namespace lite { namespace lite {
#define MS_VERSION_MAJOR 0 const int ms_version_major = 0;
#define MS_VERSION_MINOR 7 const int ms_version_minor = 7;
#define MS_VERSION_REVISION 0 const int ms_version_revision = 0;
/// \brief Global method to get a version string. /// \brief Global method to get a version string.
/// ///
/// \return The version string of MindSpore Lite. /// \return The version string of MindSpore Lite.
std::string Version() { inline std::string Version() {
return "MindSpore Lite " + std::to_string(MS_VERSION_MAJOR) + "." + std::to_string(MS_VERSION_MINOR) + "." + return "MindSpore Lite " + std::to_string(ms_version_major) + "." + std::to_string(ms_version_minor) + "." +
std::to_string(MS_VERSION_REVISION); std::to_string(ms_version_revision);
} }
} // namespace lite } // namespace lite
} // namespace mindspore } // namespace mindspore

View File

@ -219,6 +219,7 @@ table CNode {
table MetaGraph { table MetaGraph {
name: string; name: string;
version: string;
fmkType: int; // 0:tf,1:caffe fmkType: int; // 0:tf,1:caffe
inputIndex: [uint]; inputIndex: [uint];
outputIndex: [uint]; outputIndex: [uint];

View File

@ -24,6 +24,7 @@
#include "include/ms_tensor.h" #include "include/ms_tensor.h"
#include "include/context.h" #include "include/context.h"
#include "src/runtime/runtime_api.h" #include "src/runtime/runtime_api.h"
#include "include/version.h"
namespace mindspore { namespace mindspore {
namespace lite { namespace lite {
@ -352,6 +353,10 @@ int Benchmark::RunBenchmark(const std::string &deviceType) {
return RET_ERROR; return RET_ERROR;
} }
auto model = lite::Model::Import(graphBuf, size); 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) { if (model == nullptr) {
MS_LOG(ERROR) << "Import model file failed while running " << modelName.c_str(); 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; std::cerr << "Import model file failed while running " << modelName.c_str() << std::endl;

View File

@ -33,6 +33,7 @@
#include "tools/converter/parser/onnx/onnx.pb.h" #include "tools/converter/parser/onnx/onnx.pb.h"
#include "tools/converter/quantizer/post_training_quantizer.h" #include "tools/converter/quantizer/post_training_quantizer.h"
#include "tools/converter/quantizer/quant_cast.h" #include "tools/converter/quantizer/quant_cast.h"
#include "include/version.h"
namespace mindspore { namespace mindspore {
namespace lite { namespace lite {
@ -154,6 +155,7 @@ int RunConverter(int argc, const char **argv) {
// save graph to file // save graph to file
Storage storage; Storage storage;
fb_graph->version = Version();
status = storage.Save(*fb_graph, flags->outputFile); status = storage.Save(*fb_graph, flags->outputFile);
if (status != 0) { if (status != 0) {
MS_LOG(ERROR) << "Save graph failed"; MS_LOG(ERROR) << "Save graph failed";