当前位置:网站首页>安装nngraph
安装nngraph
2022-04-23 12:57:00 【贱贱的剑】
参考链接
- 参考链接1: https://github.com/torch/nngraph/issues/52
- 参考链接2: https://github.com/torch/paths/blob/master/rocks/paths-scm-1.rockspec
- 参考链接3: https://github.com/torch/rocks/blob/master/torch-scm-1.rockspec
- 参考链接4: https://github.com/torch/rocks/blob/master/cwrap-scm-1.rockspec
各种需要的文件
1. torch7-master.zip
2. paths-master.zip
3. nngraph-master.zip
4. graph-master.zip
5. cwrap-master.zip
问题
在Ubuntu18.04上运行lua代码的时候遇到了缺少nngraph的问题,各种google都找不到,只有参考链接1有一点儿线索。链接中给的解决方案如下
sudo luarocks --from=https://raw.githubusercontent.com/torch/rocks/master/ install nngraph
此解决方案是在2015年底提出来的,现在由于安全的原因报出如下问题。但这错误提示给我们提供了一点儿解决问题的线索。
解决方案
- 错误提示中间那个
github
地址无法下载。我们在github上搜索paths
,找到了参考链接2 的地址,将整个torch/paths
项目下载下来(paths-master.zip文件
) 。然后使用unzip paths-master.zip
进行解压。 - 进入
paths-master
目录,使用
sudo luarocks make rocks/paths-scm-1.rockspec
命令进行编译安装。最后结果如下
- 继续执行命令
sudo luarocks --from=https://raw.githubusercontent.com/torch/rocks/master/ install nngraph
依然发现如下错误
这次我们将torch-scm-1.rockspec
(参考链接3)和cwrap-scm-1.rockspec
(参考链接4)一起安装。
-
链接3和链接4显示的是众多的
rocks
中的两个,并没有源码。因此无法通过源码编译进行安装,仔细查看内容,我们发现了它的源码地址(由于链接3
的安装依赖于链接4
,因此我们先安装链接4
中的cwrap-scm-1.rockspec
)。
-
可以通过命令行拉取
url
字段中的源码,也可以在浏览器中进入homepage
字段的地址进行下载。 -
下载完成后(参见
各种需要的文件
中的cwrap-master.zip
文件)。 解压并进入cwrap-master
文件夹,输入命令
sudo luarocks make rocks/cwrap-scm-1.rockspec
则如下所示,安装完成
- 同样的操作获取
参考链接3
中的torch-scm-1.rockspec
源码(参见各种需要的文件
中的torch7-master.zip
文件)。解压并进入torch7-master
文件夹,执行命令
sudo luarocks make rocks/torch-scm-1.rockspec
这是一个比较耗时的过程,耐心等待命令运行完成。最后结果如下所示
- 继续执行命令
sudo luarocks --from=https://raw.githubusercontent.com/torch/rocks/master/ install nngraph
看看还缺少什么。
-
果然还缺少文件,我们从下往上依次安装
-
将
grap-scm-1.rockspec
的地址输入浏览器,我们能看到它的源码地址。
-
同样可以通过两种方法得到源码(参见
各种需要的文件
中的graph-master.zip
文件 )。下载、解压、进入graph-master
目录并执行命令。
sudo luarocks make rocks/graph-scm-1.rockspec
-
安装完成
-
同样的方式找到
nngraph
的下载地址为https://github.com/torch/nngraph
或git://github.com/torch/nngraph
。 -
将下载好的文件(或参见
各种需要的文件
中的nngraph-master.zip
文件)解压进入nngraph-master
目录, 使用mkdir rocks
创建文件夹,并新建rocks/nngraph-scm-1.rockspec
文件,内容为
package = "nngraph"
version = "scm-1"
source = {
url = "git://github.com/torch/nngraph",
tag = "master"
}
description = {
summary = "This package provides graphical computation for nn library in Torch7.",
homepage = "https://github.com/torch/nngraph",
license = "UNKNOWN"
}
dependencies = {
"torch >= 7.0",
"graph",
"nn"
}
build = {
type = "command",
build_command = [[
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(LUA_BINDIR)/.." -DCMAKE_INSTALL_PREFIX="$(PREFIX)" && $(MAKE)
]],
install_command = "cd build && $(MAKE) install"
}
- 在
nngraph-master
目录下执行
sudo luarocks make rocks/nngraph-scm-1.rockspec
安装,安装结果如下
测试
- 使用
lua
交互环境运行require 'nngraph'
时,会报如下错误。
- 使用
lua5.1
交互环境运行require 'nngraph'
时,会报如下错误。
上述是两个完全不同的错误,接下来研究如何解决。
版权声明
本文为[贱贱的剑]所创,转载请带上原文链接,感谢
https://blog.csdn.net/wzj_sxpi/article/details/124332640
边栏推荐
- 教你快速开发一个 狼人杀微信小程序(附源码)
- Start mqbroker CMD failure resolution
- 大家帮我看一下这是啥情况,MySQL5.5的。谢了
- The continuous construction of the Internet industry platform is not only able to collect traffic
- If you were a golang interviewer, what questions would you ask?
- 有趣的IDEA插件推荐,给你的开发工作增添色彩
- SSM framework series - annotation development day2-2
- Synchronously update the newly added and edited data to the list
- NPDP|产品经理如何做到不会被程序员排斥?
- 31. 下一个排列
猜你喜欢
云原生KubeSphere部署Mysql
Unlock openharmony technology day! The annual event is about to open!
How to prevent the website from being hacked and tampered with
Homomorphic encryption technology learning
将新增和编辑的数据同步更新到列表
Packet capturing and sorting -- TCP protocol [8]
如何防止网站被黑客入侵篡改
【csnote】ER图
World Book Day: I'd like to recommend these books
About the 'enum' enumeration type and structure.
随机推荐
V-model binding value in El select, data echo only displays value, not label
BUUCTF WEB [BJDCTF2020]The mystery of ip
STM32 control stepper motor (ULN2003 + 28byj)
No idle servers? Import OVF image to quickly experience smartx super fusion community version
解决disagrees about version of symbol device_create
Synchronously update the newly added and edited data to the list
Kubernetes 入门教程
Free and open source intelligent charging pile SaaS cloud platform of Internet of things
leetcode:437. Path sum III [DFS selected or not selected?]
Realize several "Postures" in which a box is horizontally and vertically centered in the parent box
Teach you to quickly develop a werewolf killing wechat applet (with source code)
BUUCTF WEB [BJDCTF2020]The mystery of ip
How to click an object to play an animation
风尚云网学习-input属性总结
mysql支持ip访问
Get the punch in record of nailing attendance machine
Remote access to raspberry pie at home (Part 1)
leetcode-791. 自定义字符串排序
世界读书日:我想推荐这几本书
Golang implements a five insurance and one gold calculator with web interface