ONE - On-device Neural Engine
Loading...
Searching...
No Matches
caffe2circle.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <caffe_importer.h>
18#include <mir2loco.h>
19#include <exo/CircleExporter.h>
20
21#include <cstdlib>
22#include <iostream>
23
24int main(int argc, char *argv[])
25{
26 if (argc != 3)
27 {
28 std::cerr << "Usage: caffe2circle <path/to/caffe/model> <path/to/circle/model>\n";
29 return EXIT_FAILURE;
30 }
31
32 const char *caffe_path = argv[1];
33 const char *circle_path = argv[2];
34
35 std::unique_ptr<mir::Graph> mir_graph = mir_caffe::importModelFromBinaryFile(caffe_path);
36 std::unique_ptr<loco::Graph> loco_graph = mir2loco::Transformer().transform(mir_graph.get());
37 exo::CircleExporter(loco_graph.get()).dumpToFile(circle_path);
38 return EXIT_SUCCESS;
39}
int main(void)
void dumpToFile(const char *path) const
write to a file
std::unique_ptr< loco::Graph > transform(mir::Graph *mir_graph)
Definition mir2loco.cpp:710
std::unique_ptr< mir::Graph > importModelFromBinaryFile(const std::string &filename)