STT-tensorflow/tensorflow/lite/tools/versioning/runtime_version.h
Thai Nguyen e887f933e4 Add the missing versions to runtime version
This cl also add a new unit test to ensure new version
got reflected in runtime version.

PiperOrigin-RevId: 316630739
Change-Id: I139ecf3077b2eec9bcc13ea5bb9030199d29203a
2020-06-16 00:43:59 -07:00

40 lines
1.7 KiB
C++

/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_TOOLS_VERSIONING_RUNTIME_VERSION_H_
#define TENSORFLOW_LITE_TOOLS_VERSIONING_RUNTIME_VERSION_H_
#include <string>
#include "flatbuffers/flatbuffers.h" // from @flatbuffers
#include "tensorflow/lite/schema/mutable/schema_generated.h"
namespace tflite {
// Update minimum runtime version of the given TFL flatbuffer model.
void UpdateMinimumRuntimeVersionForModel(uint8_t* model_buffer_pointer);
// Find the minimum runtime version of a given op version. Return an empty
// string the version is not registered.
std::string FindMinimumRuntimeVersionForOp(tflite::BuiltinOperator op_code,
int op_version);
// Returns true if the first version string precedes the second.
// For example, '1.9' should precede '1.14', also '1.14' should precede
// '1.14.1'. If two version string is equal, then false will be returned.
bool CompareRuntimeVersion(const std::string&, const std::string&);
} // namespace tflite
#endif // TENSORFLOW_LITE_TOOLS_VERSIONING_RUNTIME_VERSION_H_