## 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混合編程