• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Attempt to call local 'callback' (a nil value)

changx

New Member
Joined
May 21, 2019
Messages
2
Reaction score
0
Hello! The first time I used lua, I encountered this mistake and didn't know how to solve it. Thank you for your help.
I used torch7 cudnn7 lua5.2
Here's my runtime error
Lua:
/home/jm/torch/install/bin/lua: /home/jm/torch/install/share/lua/5.2/nn/Module.lua:352: attempt to call local 'callback' (a nil value)
stack traceback:
    /home/jm/torch/install/share/lua/5.2/nn/Module.lua:352: in function 'apply'
    ...nowflake/Downloads/CCX/seGAN/networks/End2EndNetwork.lua:81: in function 'defineG'
    ...nowflake/Downloads/CCX/seGAN/networks/End2EndNetwork.lua:130: in function 'init_networks'
    ...nowflake/Downloads/CCX/seGAN/networks/End2EndNetwork.lua:343: in main chunk
    [C]: in function 'dofile'
    /home/jm/torch/install/share/lua/5.2/paths/init.lua:84: in function 'dofile'
    main.lua:265: in main chunk
    [C]: in function 'dofile'
    ...cau2/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
    [C]: in ?

And here's part of my code:
Lua:
local function defineG(input_nc, output_nc, ngf)
    local netG = nil
    if     opt.which_model_netG == "encoder_decoder" then netG = defineG_encoder_decoder(input_nc, output_nc, ngf)
    elseif opt.which_model_netG == "unet" then netG = defineG_unet(input_nc, output_nc, ngf)
    elseif opt.which_model_netG == "unet_128" then netG = defineG_unet_128(input_nc, output_nc, ngf)
    else error("unsupported netG model")
    end

      netG:apply(weights_init)
 
    return netG
end

Is this a problem with the Lua version? Causing an error in the 'apply' function? But I don't know what to do. Thank you for your help.
 
Where is weights_init defined? I'm assuming that's the callback that the apply method is trying to execute.
 
Solution
Back
Top