diff options
Diffstat (limited to 'compiler/luci/tester/src/ReadTester.cpp')
-rw-r--r-- | compiler/luci/tester/src/ReadTester.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/compiler/luci/tester/src/ReadTester.cpp b/compiler/luci/tester/src/ReadTester.cpp index c105d6ce3..a1aead1bd 100644 --- a/compiler/luci/tester/src/ReadTester.cpp +++ b/compiler/luci/tester/src/ReadTester.cpp @@ -1,4 +1,20 @@ -#include "Model.h" +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. 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. + */ + +#include <foder/FileLoader.h> #include <luci/Importer.h> #include <luci/Service/Validate.h> @@ -37,7 +53,7 @@ void show_error_message(const char *progname, std::ostream &os, const std::strin * dump graph to console if set. * i.e. "LUCI_LOG=1 luci_readtester mymodel.circle" */ -int main(int argc, char **argv) +int entry(int argc, char **argv) { if (argc != 2) { @@ -50,22 +66,17 @@ int main(int argc, char **argv) std::cout << "[INFO] Circle is '" << input_path << "'" << std::endl; // Load model from the file - std::unique_ptr<luci::Model> model = luci::load_model(input_path); - if (model == nullptr) + foder::FileLoader file_loader{input_path}; + std::vector<char> model_data = file_loader.load(); + const circle::Model *circle_model = circle::GetModel(model_data.data()); + if (circle_model == nullptr) { - std::cerr << "ERROR: Failed to load '" << input_path << "'" << std::endl; - return 255; - } - - const circle::Model *input_model = model->model(); - if (input_model == nullptr) - { - std::cerr << "ERROR: Failed to read '" << input_path << "'" << std::endl; - return 255; + std::cerr << "ERROR: Failed to load circle '" << input_path << "'" << std::endl; + return EXIT_FAILURE; } luci::Importer importer; - auto module = importer.importModule(input_model); + auto module = importer.importModule(circle_model); assert(module->size() > 0); for (size_t g = 0; g < module->size(); ++g) |