【问题标题】:Openresty torch module loading issueOpenresty 火炬模块加载问题
【发布时间】:2015-09-03 02:11:44
【问题描述】:

我正在尝试将 openresty 与 torch 一起用于神经网络的 Rest api。 第一个查询有效,之后的任何查询都失败。

Nginx 配置

workers processes 1;

error_log logs/error.log;
events {
    workers connections 1024
}
http {
    server {
        listen 5050;
        location /{
            default type text/html;
            content_by_lua_file /home/yiftach/testFile.lua;
        } 
    } 
}

testFile.lua

require "nn" 
local tensorA=torch.zeros(1,1)
ngx.say(tensorA:size()[1])

错误:

Lua entry thread aborted: runtime error: /home/yiftach/testFile.lua: attempt to index global 'torch' (a nil value)

不胜感激

【问题讨论】:

  • 需要'火炬'?我没有看到 nn 包的任何用法
  • 没有'torch'包,nn包含了torch对象

标签: nginx lua luajit torch openresty


【解决方案1】:

你没有require 火炬库。 在顶部添加local torch = require "torch"

【讨论】:

    猜你喜欢
    • 2019-07-08
    • 2018-09-02
    • 1970-01-01
    • 2018-01-24
    • 2019-07-27
    • 2021-09-22
    • 2022-06-27
    • 2016-07-07
    • 2021-07-04
    相关资源
    最近更新 更多