Openresty torch 模块加载问题

我正在尝试使用openresty和torch为神经网络创建Rest api。第一个查询工作正常,之后的任何查询都失败了。

Nginx Config

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])

The error:

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

感谢任何帮助

点赞
用户282536
用户282536

你没有使用torch库。 在代码开头添加local torch = require "torch"

2015-06-20 07:46:02