torch环境搭建

源链接  https://blog.csdn.net/hp910315/article/details/53545854

torch是一个深度学习的工具,它使用lua语言编写,集成了各种深度学习开发包。下面具体来看看torch环境的搭建过程。

1、torch的安装

具体可以参考 http://torch.ch/docs/getting-started.html

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

安装完了需要刷新环境变量配置

source ~/.bashrc
  • 1

添加环境变量,在终端输入:

vi /etc/profile
  • 1

进入文件后,在最后添加如下命令:

PATH=~/torch/install/bin:$PATH
  • 1

直接在命令行中输入th命令测试安装是否成功

成功的结果如下:

$ th

  ______             __   |  Torch7                                   
 /_  __/__  ________/ /   |  Scientific computing for Lua.         
  / / / _ \/ __/ __/ _ \  |                                           
 /_/  \___/_/  \__/_//_/  |  https://github.com/torch   
                          |  http://torch.ch            

th> torch.Tensor{1,2,3}
 1
 2
 3
[torch.DoubleTensor of dimension 3]

th>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

2、安装相关开发依赖包

torch使用luarocks来安装相关的依赖开发包

luarocks install image
luarocks install optim  
luarocks install itorch   
luarocks install gnuplot 
  • 1
  • 2
  • 3
  • 4

执行下面命令可以查看所以安装的依赖包

luarocks list
  • 1

3、itorch的安装

在上面我们已经安装了itorch对应的包,但是还必须要有ipython才可以。

输入如下命令安装ipython

pip install ipython
pip install "ipython[notebook]"
  • 1
  • 2

最后命令行执行下面命令检验ipython是否安装成功

ipython notebook
  • 1

运行之后会出现如下界面:

这里写图片描述

命令行输入下面命令就会进入itorch 的网页可视化界面

itorch notebook
  • 1

在这个可视化界面我们就可以像在命令行里面一样,进行torch的相关命令操作

例如:

这里写图片描述

对于iTorch具体可以参考

https://github.com/facebook/iTorch

4、使用torch工具开发的相关深度学习项目

https://github.com/nagadomi/waifu2x

https://github.com/jcjohnson/neural-style

https://github.com/karpathy/neuraltalk2

https://github.com/karpathy/char-rnn

6、有关torch的相关学习资料

https://www.julyedu.com/video/play/18/130

https://github.com/torch/torch7

https://github.com/torch/torch7/wiki/Cheatsheet

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hp910315/article/details/53545854

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值