ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Driver.cpp File Reference
#include "PModelsRunner.h"
#include <luci/Log.h>
#include <iostream>

Go to the source code of this file.

Functions

int entry (int argc, char **argv)
 

Function Documentation

◆ entry()

int entry ( int  argc,
char **  argv 
)

Definition at line 23 of file Driver.cpp.

24{
25 LOGGER(l);
26
27 if (argc != 5)
28 {
29 std::cerr
30 << "Usage: " << argv[0]
31 << " <path/to/partition/config> <num_inputs> <path/to/input/prefix> <path/to/output/file>\n";
32 return EXIT_FAILURE;
33 }
34 // NOTE: about input/output data file name
35 // - I/O file name format is like filename.ext0, filename.ext1, ...
36 // NOTE: about output shape
37 // - file name with filename.ext0.shape, filename.ext1.shape, ...
38 // having one line text content of CSV format(like H,W or N,C,H,W)
39
40 const char *config_filename = argv[1];
41 const int32_t num_inputs = atoi(argv[2]);
42 const char *input_prefix = argv[3];
43 const char *output_file = argv[4];
44
46
47 INFO(l) << "Read config file: " << config_filename << std::endl;
48 if (not pmrunner.load_config(config_filename))
49 return EXIT_FAILURE;
50
51 INFO(l) << "Read input file: " << input_prefix << ", #inputs: " << num_inputs << std::endl;
52 pmrunner.load_inputs(input_prefix, num_inputs);
53
54 INFO(l) << "Run all partitioned models..." << std::endl;
55 if (!pmrunner.run())
56 return EXIT_FAILURE;
57
58 INFO(l) << "Save output file: " << output_file << std::endl;
59 pmrunner.save_outputs(output_file);
60
61 return EXIT_SUCCESS;
62}
#define LOGGER(name)
Definition Log.h:65
#define INFO(name)
Definition Log.h:68
PModelsRunner runs partitioned models from input data file and stores output data to a file.
void save_outputs(const std::string &output_file)
void load_inputs(const std::string &input_prefix, int32_t num_inputs)
bool load_config(const std::string &filename)

References INFO, prunner::PModelsRunner::load_config(), prunner::PModelsRunner::load_inputs(), LOGGER, prunner::PModelsRunner::run(), and prunner::PModelsRunner::save_outputs().