ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Driver.cpp File Reference
#include "tflchef/ModelChef.h"
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/text_format.h>
#include <iostream>

Go to the source code of this file.

Functions

int entry_stream (std::istream &is)
 
int entry (int, char **)
 Dump IR for given arguments.
 

Function Documentation

◆ entry()

int entry ( 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 60 of file Driver.cpp.

61{
62 // forward to entry_stream
63 return entry_stream(std::cin);
64}
int entry_stream(std::istream &is)
Definition Driver.cpp:25

References entry_stream().

◆ entry_stream()

int entry_stream ( std::istream &  is)

Definition at line 25 of file Driver.cpp.

26{
27 int32_t model_version = 1;
28
29 ::tflchef::ModelRecipe model_recipe;
30
31 // Read a model recipe from standard input
32 {
33 google::protobuf::io::IstreamInputStream iis{&is};
34 if (!google::protobuf::TextFormat::Parse(&iis, &model_recipe))
35 {
36 std::cerr << "ERROR: Failed to parse recipe" << std::endl;
37 return 255;
38 }
39
40 if (model_recipe.has_version())
41 {
42 model_version = model_recipe.version();
43 }
44 }
45
46 if (model_version > 1)
47 {
48 std::cerr << "ERROR: Unsupported recipe version: " << model_version << std::endl;
49 return 255;
50 }
51
52 auto generated_model = tflchef::cook(model_recipe);
53
54 // Write a generated model into standard output
55 std::cout.write(generated_model.base(), generated_model.size());
56
57 return 0;
58}
GeneratedModel cook(const ModelRecipe &model_recipe)

References tflchef::cook().