Lua使用相关问题


相关教程

Learn Lua in 15 Minutes 该代码较为简单,将LUA中的基本语法大致讲完,代码已经下载至cv_learning中可以自己注释增加。

Lua 教程 菜鸟教程,分类清晰,模块化学习。

torch7 readme

torch中文资料

torch nn

torch Cheatsheet

torch-Video-Tutorials 其中提供了torch相关的视频教程,作者实现了一个视频预测的pytorch版本,值得学习。


博客资料

torch学习

torch 深度学习(4)


设置代理

vim /etc/luarocks/config.lua
proxy = [[http://10.xx.xx.xx:8888]]

luarocks 代理设置


常用模块

运行torch,输入th torch_cmd_scripts.lua即可,或者在th中输入dofile ‘torch_cmd_scripts.lua’

Element-Research 该仓库中提供了大量的torch常用代码,包括rnn,dataload

torchnet

local tnt = require 'torchnet'

torchnet

torch

读取command参数

local cmd = torch.CmdLine()
cmd:option('-usegpu', false, 'use gpu for training')
local config = cmd:parse(arg)
print(string.format('running on %s', config.usegpu and 'GPU' or 'CPU'))

randperm

torch.randperm(n, out=None) → LongTensor给定参数n,返回一个随机的1-n的数据。

torch.randperm(4)

Penlight

该模块是torch中用来进行配置文件的读取

Penlight Lua Libraries 1.5.4

Penlight

require 'pl'
print(app.appfile 'test.txt')

paths

torch中的文件相关操作库

paths

paths.readthedocs

垃圾收集collectgarbage

a = {1,2,3}
a = nil
collectgarbage()

垃圾回收机制

collectgarbage

class

torch中面向对象编程的库

class

nngraph

Introduction to nngraph

nngraph

使用Torch nngraph实现LSTM

torch-hdf5

torch中读取hdf5的模块

torch-hdf5