SCNN icon indicating copy to clipboard operation
SCNN copied to clipboard

Training error after modifying nn.View and nn.Linear

Open juntawu opened this issue 6 years ago • 5 comments

I simply remove the nn.View(4500) and insert a new nn.View(4500) in SCNN-gen.lua, as the following shows:

classifier = model:get(44):get(2)
classifier:remove(3)
classifier:insert(nn.View(4500), 3)
classifier:remove(4)
classifier:insert(nn.Linear(4500, 128), 4)

Error comes durining training:

/home/lishanliao/torch/install/bin/luajit:` ...shanliao/torch/install/share/lua/5.1/threads/threads.lua:183: [thread 2 callback] .../lishanliao/torch/install/share/lua/5.1/nn/Container.lua:67: 
In 44 module of nn.Sequential:
In 2 module of nn.ConcatTable:
In 7 module of nn.Sequential:
/home/lishanliao/torch/install/share/lua/5.1/nn/THNN.lua:110: output and gradOutput have different number of elements: output[4] has 4 elements, while gradOutput[3] has 3 elements at /home/lishanliao/torch/extra/cunn/lib/THCUNN/generic/Sigmoid.cu:23

What's wrong???

juntawu avatar Jul 17 '18 09:07 juntawu

@XingangPan Can you release the code to generate vgg.t7 please ?

juntawu avatar Jul 17 '18 12:07 juntawu

Try doing classifier: insert(nn.Linear(4500, 128), 3) instead

(edit) I'm sorry, but my response is incorrect. See what @cardwing suggested.

virajdeokar avatar Jul 31 '18 16:07 virajdeokar

@juntawu , @virajdeokar , please refer to this issue 143.

cardwing avatar Aug 01 '18 14:08 cardwing

@juntawu What's your GPU's number and it's memory?

ChangshiFan avatar Aug 12 '18 09:08 ChangshiFan

@leofanpico 7 GPUs, 8 G per GPU

juntawu avatar Aug 14 '18 12:08 juntawu