71 ctx->
sinks()->
append(std::make_unique<hermes::ConsoleReporter>());
72 ctx->
config(std::make_unique<EnvConfig>(
"TF2CIRCLE_Log"));
81 std::cerr <<
"Usage: tf2circle <path/to/info> <path/to/pb> <path/to/circle/model> " << std::endl
82 <<
"Options: --customop <path/to/customop.conf>" << std::endl;
88 ::Logger name { ::LoggingContext::get() }
90#define INFO(name) HERMES_INFO(name)
95void internal_error(
void)
97 std::cerr <<
"tf2circle: internal compiler error" << std::endl;
116 int operator()(
int argc,
char **argv)
const;
119EntryFunctor::EntryFunctor()
124EntryFunctor::~EntryFunctor()
129int EntryFunctor::operator()(
int argc,
char **argv)
const
141 if (!(argc == 4 or argc == 6))
147 std::string info_path{
argv[1]};
148 std::string tf_path{
argv[2]};
149 std::string circle_path{
argv[3]};
151 std::cout <<
"Read '" << info_path <<
"'" << std::endl;
155 for (
const auto &
info :
nnkit::support::tftestinfo::
parse(info_path.c_str()))
157 switch (
info->kind())
170 throw std::runtime_error{
"Unknown kind"};
177 if (std::string{
argv[4]} ==
"--customop")
188 std::cout <<
"Read '" << info_path <<
"' - Done" << std::endl;
190 std::cout <<
"Import from '" << tf_path <<
"'" << std::endl;
191 auto g =
import(sig, tf_path);
192 std::cout <<
"Import from '" << tf_path <<
"' - Done" << std::endl;
194 INFO(l) <<
"Import Graph" << std::endl;
195 INFO(l) << locop::fmt<locop::Formatter::LinearV1>(g) << std::endl;
197 std::cout <<
"Export into '" << circle_path <<
"'" << std::endl;
199 std::cout <<
"Export into '" << circle_path <<
"' - Done" << std::endl;
213 return entry(argc, argv);
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
int entry(const int argc, char **argv)
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