Skip to content

Instantly share code, notes, and snippets.

View Halfish's full-sized avatar
🏠
Working from home

Bruce Halfish

🏠
Working from home
  • Sun Yat-sen University
  • Guangzhou, China
View GitHub Profile
@Halfish
Halfish / argparse.py
Last active August 6, 2018 14:43
Python常见语法笔录
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 August 6, 2018 14:42
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')