## Torch的安装
### I.安装torch
参考官网给的教程:[http://torch.ch/docs/getting-started.html](http://torch.ch/docs/getting-started.html)
```bash
# in a terminal, run the commands WITHOUT sudo
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
sudo ./install.sh
```
如果是linux操作系统执行
```bash
source ~/.bashrc
```
如果是linux操作系统,zsh终端执行
```
source ~/.zshrc
```
\#如果是OSX苹果
```bash
source ~/.profile
```
#### 如果想安装Lua-5.2版本的torch,可以执行如下操作
```
```
```bash
cd ~/torch
# clean old torch installation
./clean.sh
# optional clean command (for older torch versions)
# curl -s https://raw.githubusercontent.com/torch/ezinstall/master/clean-old.sh | bash
# https://github.com/torch/distro : set env to use lua
TORCH_LUA_VERSION=LUA52 ./install.sh
```
#### 如果想要删除torch,可以执行如下操作
```Bash
rm -rf ~/torch
```
### II.运行torch
```Bash
liudanbing@iZ25vg8hotaZ:~/torch$ th
______ __ | Torch7
/_ __/__ ________/ / | Scientific computing for Lua.
/ / / _ \/ __/ __/ _ \ | Type ? for help
/_/ \___/_/ \__/_//_/ | https://github.com/torch
| http://torch.ch
```
如果能够打印如上,代表torch运行成功.
- 1 Lua介绍及环境
- 2 基本语法
- 3 数据类型
- 4 Lua 变量
- 5 循环
- 6 流程控制
- 7 函数
- 8 运算符
- 9 字符串
- 10 数组
- 11 迭代器
- 12 table
- 13 Lua 模块与包
- 14 Lua 元表(Metatable)
- 14.1 元表案例
- 15 Lua 协同程序(coroutine)
- 16 Lua 文件IO
- 17 Lua 面向对象
- 17.1 类
- 17.2 继承
- 17.3 封装
- 18 Lua 与 Mysql
- 19 Lua 与 redis
- 20 Lua 与 JSON
- 21 Lua 与 http
- 22 Lua 与 Nginx
- 22.1 Nginx_Lua的安装及环境
- 22.2 ngx_lua API(全表)
- 22.3 常用命令介绍
- 22 Lua 人工智能
- (1) Torch的安装
- (2)Tensor
- Lua与C混合编程