34 arser::Arser arser(
"fm-apply applies channel-wise scale/shift for FM equalization");
38 arser.add_argument(
"--input").required().help(
"Input circle model");
40 arser.add_argument(
"--fme_patterns")
42 .help(
"Json file that describes feture map equalization info");
44 arser.add_argument(
"--output").required().help(
"Output circle model");
48 arser.parse(argc, argv);
50 catch (
const std::runtime_error &err)
52 std::cerr << err.what() << std::endl;
57 if (
arser.get<
bool>(
"--verbose"))
61 setenv(
"LUCI_LOG",
"100", 0);
64 const std::string input_path =
arser.get<std::string>(
"--input");
65 const std::string fme_patterns_path =
arser.get<std::string>(
"--fme_patterns");
66 const std::string output_path =
arser.get<std::string>(
"--output");
69 auto module = importerex.importVerifyModule(input_path);
70 assert(module !=
nullptr);
74 for (
size_t idx = 0; idx <
module->size(); ++idx)
76 auto graph =
module->graph(idx);
83 std::cerr <<
"ERROR: Equalized graph is invalid" << std::endl;
93 if (!exporter.
invoke(&contract))
95 std::cerr <<
"ERROR: Failed to export '" << output_path <<
"'" << std::endl;
static void add_verbose(Arser &arser)
void equalize(loco::Graph *g, std::vector< EqualizePattern > &p)
bool invoke(Contract *) const
int entry(int argc, char **argv)
Dump IR for given arguments.
std::vector< EqualizePattern > read(const std::string &filename)
bool validate(luci::PartitionTable &partition)