71 ctx->
sinks()->
append(std::make_unique<hermes::ConsoleReporter>());
72 ctx->
config(std::make_unique<EnvConfig>(
"TF2TFLITE_Log"));
81 std::cerr <<
"Usage: tf2tflite <path/to/info> <path/to/pb> <path/to/tflite/model> " << std::endl
82 <<
"Options: --customop <path/to/customop.conf>" << std::endl;
88 ::Logger name { ::LoggingContext::get() }
90#define INFO(name) HERMES_INFO(name)
92int main(
int argc,
char **argv)
104 if (!(argc == 4 or argc == 6))
110 std::string info_path{argv[1]};
111 std::string tf_path{argv[2]};
112 std::string tflite_path{argv[3]};
114 std::cout <<
"Read '" << info_path <<
"'" << std::endl;
120 switch (
info->kind())
133 throw std::runtime_error{
"Unknown kind"};
140 if (std::string{argv[4]} ==
"--customop")
151 std::cout <<
"Read '" << info_path <<
"' - Done" << std::endl;
153 std::cout <<
"Import from '" << tf_path <<
"'" << std::endl;
154 auto g =
import(sig, tf_path);
155 std::cout <<
"Import from '" << tf_path <<
"' - Done" << std::endl;
157 INFO(l) <<
"Import Graph" << std::endl;
158 INFO(l) << locop::fmt<locop::Formatter::LinearV1>(g) << std::endl;
160 std::cout <<
"Export into '" << tflite_path <<
"'" << std::endl;
162 std::cout <<
"Export into '" << tflite_path <<
"' - Done" << std::endl;
This file contains functions to parse test.info files in moco/test/tf.
void dumpToFile(const char *path) const
write to a file
Source::Registry * sources(void)
Sink::Registry * sinks(void)
const Config * config(void) const
Get the global configuration.
void activate(Registry *, MessageBus *)
std::unique_ptr< loco::Graph > load(const ModelSignature &, const char *, FileType) const
volatile const char info[]
KnobTrait< K >::ValueType get(void)
std::vector< std::unique_ptr< ParsedTensor > > parse(const char *info_path)
Function to parse test.info.
void load_customop_conf(const std::string &path, moco::ModelSignature &sig)
Loads customop.conf into ModelSignature.
static hermes::Context * get(void)
virtual void append(std::unique_ptr< Sink > &&)=0
static hermes::Context * get(void)
Class to store information to run a model. Normally this info comes from users via CLI params or conf...
void add_input(const TensorName &input)
void add_output(const TensorName &output)
void shape(const std::string &node_name, const angkor::TensorShape &shape)
Adds node name and its shape provided from user.
const std::string & name() const