From e4636bf95e071f56f75e667b6248a754bc2bed4e Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Mon, 2 May 2022 11:25:46 +0900 Subject: [PATCH] [circle-partitioner] Change to optional arguments (#9081) This will change positional to optional arguments. ONE-DCO-1.0-Signed-off-by: SaeHie Park --- .../src/CirclePartitioner.cpp | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/compiler/circle-partitioner/src/CirclePartitioner.cpp b/compiler/circle-partitioner/src/CirclePartitioner.cpp index 8175041ea2a..5cecb9ae0cb 100644 --- a/compiler/circle-partitioner/src/CirclePartitioner.cpp +++ b/compiler/circle-partitioner/src/CirclePartitioner.cpp @@ -39,9 +39,9 @@ namespace const char *opt_bks = "--backends"; const char *opt_def = "--default"; -const char *opt_part = "partition"; -const char *opt_input = "input"; -const char *opt_work = "work"; +const char *opt_part_file = "--part_file"; +const char *opt_input_file = "--input_file"; +const char *opt_work_path = "--work_path"; void print_version(void) { @@ -57,10 +57,12 @@ void build_arser(arser::Arser &arser) arser.add_argument(opt_def).help("Default backend to assign"); - arser.add_argument(opt_part).help("Partition file which provides backend to assign"); - arser.add_argument(opt_input).help("Input circle model filename"); - arser.add_argument(opt_work).help( - "Work folder of partition, input files exist and output files are produced"); + arser.add_argument(opt_part_file) + .required(true) + .help("Partition file which provides backend to assign"); + arser.add_argument(opt_input_file).required(true).help("Input circle model filename"); + arser.add_argument(opt_work_path) + .help("Work folder of partition, input files exist and output files are produced"); } std::unique_ptr load_model(const std::string &input_path) @@ -91,9 +93,14 @@ int entry(int argc, char **argv) return EXIT_FAILURE; } - std::string partition_file = arser.get(opt_part); - std::string input_file = arser.get(opt_input); - std::string work_folder = arser.get(opt_work); + std::string partition_file = arser.get(opt_part_file); + std::string input_file = arser.get(opt_input_file); + std::string work_folder = "."; + + if (arser[opt_work_path]) + { + work_folder = arser.get(opt_work_path); + } std::string partition_path = work_folder + "/" + partition_file; std::string input_path = work_folder + "/" + input_file;