From e249d09c5635d608934caefc61e4d34c68b50c61 Mon Sep 17 00:00:00 2001 From: Christopher Chalmers Date: Sun, 31 May 2020 23:09:58 +0100 Subject: [PATCH] Better documentation for run --- src/bin/run.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/bin/run.rs b/src/bin/run.rs index 74e066a..bcb47e6 100644 --- a/src/bin/run.rs +++ b/src/bin/run.rs @@ -1,17 +1,24 @@ use std::time::{Duration, Instant}; use onnxruntime::*; -use structopt::StructOpt; +use structopt::{clap, StructOpt}; +#[structopt( + name = "run", + about = "Run a benchmark on an onnx model. Each worker runs the model `runs` times in a loop.", + setting = clap::AppSettings::ColoredHelp +)] #[derive(StructOpt)] struct Opt { - /// The path to the gru onnx file + /// The path to the onnx files to benchmark onnx: Vec, - #[structopt(long, default_value = "")] - dims: String, + /// A comma separated list of symbolic_dimension=value. If a symbolic dimension is not + /// specified, 1 will be used. + #[structopt(long)] + dims: Option, - /// The number of worker threads to spawn, each thread will run the graph in a loop + /// The number of worker threads to spawn #[structopt(long, default_value = "1")] workers: usize, @@ -96,7 +103,11 @@ fn main() -> Result<()> { let so = SessionOptions::new()?; - let map = key_val_parse(&opt.dims); + let map = if let Some(dims) = &opt.dims { + key_val_parse(dims) + } else { + HashMap::new() + }; for path in &opt.onnx { println!("model {:?}", path);