This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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') |