我正在尝试将 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;
}
}
}
测试文件.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)
非常感谢任何帮助
最佳答案
您没有需要
torch 库。
在顶部添加 local torch = require "torch"
。
关于nginx - Openresty torch 模块加载问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30898411/