[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT/LIBTFLITE PATCH 3/4] Add main app if selected
Signed-off-by: George Muraru <murarugeorgec@xxxxxxxxx> --- main.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..45f9b07 --- /dev/null +++ b/main.cpp @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +==============================================================================*/ +#define __clrsbDI2 __NDW(clrsb,2) + +#include <cstdio> +#include "tensorflow/lite/interpreter.h" +#include "tensorflow/lite/kernels/register.h" +#include "tensorflow/lite/model.h" +#include "tensorflow/lite/optional_debug_tools.h" + +#include <sys/mount.h> +#include <sys/types.h> +#include <fcntl.h> + +// This is an example that is minimal to read a model +// from disk and perform inference. There is no data being loaded +// that is up to you to add as a user. +// +// NOTE: Do not add any dependencies to this that cannot be built with +// the minimal makefile. This example must remain trivial to build with +// the minimal build tool. +// +// Usage: minimal <tflite model> + +using namespace tflite; + +int main() { + const char* filename = "mobilenet_v1_1.0_224.tflite"; + + // Load model + std::unique_ptr<tflite::FlatBufferModel> model = + tflite::FlatBufferModel::BuildFromFile(filename); + + // Build the interpreter + tflite::ops::builtin::BuiltinOpResolver resolver; + InterpreterBuilder builder(*model, resolver); + std::unique_ptr<Interpreter> interpreter; + builder(&interpreter); + + printf("=== Interpreter State ===\n"); + tflite::PrintInterpreterState(interpreter.get()); + + return 0; +} -- 2.25.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |