Skip to content

Instantly share code, notes, and snippets.

Avatar

Bruce Halfish

View GitHub Profile
@Halfish
Halfish / argparse.py
Last active Aug 6, 2018
Python常见语法笔录
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.")
@Halfish
Halfish / cmdline.lua
Last active Aug 6, 2018
Lua常见语法总结备忘
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')
You can’t perform that action at this time.