ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Driver.cpp File Reference
#include "minmax-embedder/Embedder.h"
#include <arser/arser.h>
#include <vconone/vconone.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void print_version (void)
 
int entry (const int argc, char **argv)
 Dump IR for given arguments.
 

Function Documentation

◆ entry()

int entry ( const int  argc,
char **  argv 
)

Dump IR for given arguments.

Call example: $ ./build/compiler/encodump/encodump \ –frontend build/compiler/enco/frontend/caffe/libenco_caffe_frontend.so \ –frontend-arg build/compiler/enco/test/caffe/Convolution_003.prototxt \ –frontend-arg build/compiler/enco/test/caffe/Convolution_003.caffemodel

HDF5 layout is like below

GROUP "/" ㄴGROUP "name" ㄴATTRIBUTE "0" ㄴDATA (0): "input_01:0" ㄴATTRIBUTE "1" ㄴDATA (0): "input_02:0" ㄴGROUP "value" ㄴDATASET "0" ㄴDATA ... ㄴDATASET "1" ㄴDATA ...

Definition at line 32 of file Driver.cpp.

33{
34 arser::Arser arser("minmax-embedder embeds given minmax into circle");
36 // named args
37 arser.add_argument("--min_percentile")
38 .type(arser::DataType::FLOAT)
39 .default_value(1.f)
40 .help("Set min percentile (default: 1)");
41 arser.add_argument("--max_percentile")
42 .type(arser::DataType::FLOAT)
43 .default_value(99.f)
44 .help("Set max percentile (default: 99)");
45 arser.add_argument("-o").default_value("out.circle").help("Path to output circle model");
46 // positional args: minmax(h5), input(circle)
47 arser.add_argument("circle").help("Path to input circle model");
48 arser.add_argument("minmax").help("Path to minmax data in hdf5");
49 try
50 {
51 arser.parse(argc, argv);
52 }
53 catch (const std::runtime_error &err)
54 {
55 std::cout << err.what() << std::endl;
56 std::cout << arser;
57 return EXIT_FAILURE;
58 }
59
60 std::string minmax_path = arser.get<std::string>("minmax");
61 std::string circle_path = arser.get<std::string>("circle");
62 std::string output_path = arser.get<std::string>("-o");
63 float min_percentile = arser.get<float>("--min_percentile");
64 float max_percentile = arser.get<float>("--max_percentile");
65
66 EmbedderOptions opt{min_percentile, max_percentile};
67 try
68 {
69 Embedder().embed(output_path, circle_path, minmax_path, opt);
70 }
71 catch (const std::runtime_error &err)
72 {
73 std::cout << err.what() << std::endl;
74 return EXIT_FAILURE;
75 }
76
77 return EXIT_SUCCESS;
78}
static void add_version(Arser &arser, const std::function< void(void)> &func)
Definition arser.h:755
void embed(const std::string &output_path, const std::string &input_path, const std::string &minmax_path, const EmbedderOptions &)
Definition Embedder.cpp:77
void print_version(void)
Definition Driver.cpp:26
Definition arser.h:39

References arser::Helper::add_version(), minmax_embedder::Embedder::embed(), and print_version().

◆ print_version()

void print_version ( void  )

Definition at line 26 of file Driver.cpp.

27{
28 std::cout << "minmax-embedder version " << vconone::get_string() << std::endl;
29 std::cout << vconone::get_copyright() << std::endl;
30}
std::string get_copyright(void)
get_copyright will return copyright string
Definition version.cpp:54
std::string get_string(void)
get_string will return string of major.minor.patch (without build)
Definition version.cpp:44

References vconone::get_copyright(), and vconone::get_string().

Referenced by entry().