/home/XXXX/torch/install/share/lua/5.2/optim/adamax.lua:48: attempt to call global 'unpack' (a nil value)
stack traceback:
/home/XXXX/torch/install/share/lua/5.2/optim/adamax.lua:48: in function 'adamax'
I installed torch under lua5.2 instead of luaJIT and it seems that, in lua5.2 the function 'unpack' was replaced by 'table.unpack'
require 'nn'
require 'optim'
model = nn.Sequential()
inputs = 2; outputs = 1
model:add(nn.Linear(inputs, outputs))
criterion = nn.MSECriterion()
params, gradParams = model:getParameters()
config = {learningRate = 1e-3,momentum = 0.5}
function feval(params)
gradParams:zero()
local outputs = model:forward(torch.ones(2))
local loss = criterion:forward(outputs, torch.zeros(1))
local dloss_doutputs = criterion:backward(outputs, torch.zeros(1))
model:backward(torch.ones(2), dloss_doutputs)
return loss, gradParams
end
optim.adamax(feval, params, optimState)
/home/XXXX/torch/install/bin/lua: /home/XXXX/torch/install/share/lua/5.2/optim/adamax.lua:48: attempt to call global 'unpack' (a nil value)
stack traceback:
/home/XXXX/torch/install/share/lua/5.2/optim/adamax.lua:48: in function 'adamax'
ex_fail.lua:22: in main chunk
[C]: in function 'dofile'
...urin/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?
Hello,
I run into some problems using adamax
I installed torch under lua5.2 instead of luaJIT and it seems that, in lua5.2 the function 'unpack' was replaced by 'table.unpack'
See : https://stackoverflow.com/questions/25794364/lua-trouble-attempt-to-call-global-unpack-a-nil-value
EDIT (Sample code)