View argparse.py
import argparse | |
# this file shows how to use argparse | |
# step 1,默认构造器 | |
parser = argparse.ArgumentParser() | |
# step 2, 必须输入的参数,只能在1,2,4中选一个 | |
parser.add_argument("level", type=int, choices=[1, 2, 4], help="which level to print.") |
View cmdline.lua
-- create a CmdLine object | |
cmd = torch.CmdLine() | |
-- print help text | |
cmd:text() | |
cmd:text("Options:") | |
-- define input varians and default value | |
cmd:option('-threads', 2, 'number of threads to use') | |
cmd:option('-save', 'model.t7', 'name of model to save') |