当前位置:网站首页>安装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
边栏推荐
- Van uploader upload picture implementation process, using native input to upload pictures
- Free and open source agricultural Internet of things cloud platform (version: 3.0.1)
- 风尚云网学习-input属性总结
- Learning materials
- 5 free audio material websites, recommended collection
- mysql支持ip访问
- php生成json处理中文
- Recommended website for drawing result map
- (1) Openjuterpyrab comparison scheme
- Golang implements MD5, sha256 and bcrypt encryption
猜你喜欢
![[Blue Bridge Cup] April 17 provincial competition brushing training (the first three questions)](/img/7d/23e2a611bc6a0d0239abdc79e2e8cf.png)
[Blue Bridge Cup] April 17 provincial competition brushing training (the first three questions)

风尚云网学习-h5的input:type属性的image属性

Free and open source charging pile Internet of things cloud platform

Fashion cloud learning - input attribute summary

Van uploader upload picture implementation process, using native input to upload pictures

Kubernetes 入门教程

leetcode:437. 路径总和 III【dfs 选还是不选?】

Record Alibaba cloud server mining program processing

使用Source Insight查看编辑源代码

Homomorphic encryption technology learning
随机推荐
Navicat远程连接数据库 出现 1130- Host xxx is not allowed to connect to this MySQL server错误
Please help me see what this is, mysql5 5. Thanks
SSL certificate refund instructions
Community version Alibaba MQ ordinary message sending subscription demo
Sort out several uses of network IP agent
Use compressorjs to compress pictures, optimize functions, and compress pictures in all formats
Try the server for one month for free, and attach the tutorial
STM32 is connected to the motor drive, the DuPont line supplies power, and then the back burning problem
只是不断地建构平台,不断地收拢流量,并不能够做好产业互联网
进程虚拟地址空间区域划分
Labels and paths
Bert base Chinese Download (SMART)
Keyword interpretation and some APIs in RT thread
Luogu p5540 [balkanoi2011] timeismoney | minimum product spanning tree problem solution
XinChaCha Trust SSL Organization Validated
mysql中 innoDB执行过程分析
在线计算过往日期天数,计算活了多少天
Remote sensing image classification and recognition system based on convolutional neural network
Common problems of unity (1)
如何防止网站被黑客入侵篡改