本文安装仅限 ubuntu 系统。官方文档见:Getting started with Torch

0. 简介

  • Torch 使用轻量级脚本语言 Lua 及其 C/CUDA 扩展模块实现,底层数值计算通过高效的 OpenMP/SSE/CUDA 加速;

1. 安装

进入命令行终端,分别执行下面三行的代码,

git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh

install.sh脚本会自动将 torch 路径添加进 Path 变量,因此还需执行下述代码以刷新环境变量。

# On Linux with bash
source ~/.bashrc
# On Linux with zsh
source ~/.zshrc
# On OSX or in Linux with none of the above.
source ~/.profile

2. 安装第三方库

  • $ luarocks list:查看已安装库;
  • $ luarocks install image:安装 image库;
    • $ luarocks list:再次查看是否已安装 image 库;

3. torch 命令行环境

在 ubuntu 命令行输入 th以进入 torch 的 repl (read-eval-print loop)环境。

$ th

  ______             __   |  Torch7 
 /_  __/__  ________/ /   |  Scientific computing for Lua. 
  / / / _ \/ __/ __/ _ \  |  Type ? for help 
 /_/  \___/_/  \__/_//_/  |  https://github.com/torch 
                          |  http://torch.ch 
  • th> os.exit():退出;
posted on 2017-05-13 22:43  未雨愁眸  阅读(640)  评论(0编辑  收藏  举报