Openresty火炬模块加载问题

我正在尝试使用openresty和火炬来获取neural network的Rest api。 第一个查询起作用,之后的任何查询都失败。

Nginxconfiguration

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) 

将不胜感激任何帮助

require火炬库。 添加local torch = require "torch"顶部的local torch = require "torch"