pluskid / Mocha.jl

Deep Learning framework for Julia
Other
1.29k stars 254 forks source link

Constantly getting BoundsError() #85

Closed nikolaypavlov closed 9 years ago

nikolaypavlov commented 9 years ago

Hi, I can't find the reason of this error while running the solver:

13-Aug 18:59:39:DEBUG:root:Checking network topology for back-propagation
13-Aug 18:59:39:DEBUG:root:Init network SV-train
13-Aug 18:59:39:DEBUG:root:Init parameter weight for layer fc1
13-Aug 18:59:39:DEBUG:root:Init parameter bias for layer fc1
13-Aug 18:59:39:DEBUG:root:Init parameter weight for layer fc2
13-Aug 18:59:39:DEBUG:root:Init parameter bias for layer fc2
13-Aug 18:59:39:DEBUG:root:Init parameter weight for layer out
13-Aug 18:59:39:DEBUG:root:Init parameter bias for layer out
13-Aug 18:59:39:DEBUG:root:Initializing coffee breaks
13-Aug 18:59:39:INFO:root:Snapshot directory snapshots_dropout_fc already exists
13-Aug 18:59:39:DEBUG:root:Init network SV-test
13-Aug 18:59:39:INFO:root:ITER = 000000:: TRAIN obj-val = 4.12713432
13-Aug 18:59:39:INFO:root:Saving snapshot to snapshot-000000.jld...
13-Aug 18:59:39:DEBUG:root:Saving parameters for layer fc1
13-Aug 18:59:39:DEBUG:root:Saving parameters for layer fc2
13-Aug 18:59:39:DEBUG:root:Saving parameters for layer out
13-Aug 18:59:44:INFO:root:
13-Aug 18:59:44:INFO:root:## Performance on Validation Set after 0 iterations
13-Aug 18:59:44:INFO:root:---------------------------------------------------------
13-Aug 18:59:44:INFO:root:  Accuracy (avg over 1570) = 0.0000%
13-Aug 18:59:44:INFO:root:---------------------------------------------------------
13-Aug 18:59:44:INFO:root:
13-Aug 18:59:44:DEBUG:root:Entering solver loop
BoundsError()
while loading In[18], in expression starting on line 1

 in checkbounds at abstractarray.jl:62
 in checkbounds at abstractarray.jl:70
 in broadcast_getindex! at broadcast.jl:244
 in broadcast_getindex at broadcast.jl:241
 in forward at /Users/quetzal/.julia/v0.3/Mocha/src/layers/multinomial-logistic-loss.jl:102
 in forward at /Users/quetzal/.julia/v0.3/Mocha/src/layers/softmax-loss.jl:46
 in forward at /Users/quetzal/.julia/v0.3/Mocha/src/net.jl:148
 in solve at /Users/quetzal/.julia/v0.3/Mocha/src/solvers.jl:355

The network arch is very similar to the mnist_dropout_fc.jl example, except I'm using different dataset. You can reproduce this issue from this notebook: https://github.com/nikolaypavlov/julia-dl/blob/master/Julia-DL.ipynb

pluskid commented 9 years ago

@nikolaypavlov Your code looks good to me. There is one thing that I think might be potentially causing something like this: the class labels should be from 0~(K-1), instead of from 1~K. Could you check that?

nikolaypavlov commented 9 years ago

@pluskid Yes. That was the problem... You may want to add an assertion somewhere, because BoundsError() is not very informative. Anyway thanks a lot.

pluskid commented 9 years ago

@nikolaypavlov Thanks for the suggestion! I added assertion to the CPU backend.