1

I’m recently using Knet and working on a CNN. I have a dataset-input of 20000 x 1 x 1 x 200000 which I use for training

As soon as i start training with progress!(sgd(dtrn,ncycle(n))), I get following the error:

BoundsError: attempt to access 2n-element UnitRange{Int32} at index [2n+1]

depending on the batchsize * 2. On my local computer the code is working fine, tested it and everything works with smaller dataset-examples. On the server, where Knet works fine, my code crashes tho.

Any suggestions how to fix? Already tried different batchsizes but nothing seems to work.

hellothere
  • 47
  • 3
  • It’s not seeing `n` as a variable and rather as a character it seems, can you link the full code? – logankilpatrick Apr 13 '20 at 17:13
  • the n is just a wildcard i put in there by hand to describe the problem. for example this happens when i use batchsize = 8: attempt to access 16n-element UnitRange{Int32} at index [17] – hellothere Apr 13 '20 at 17:49
  • https://pastebin.com/2ALcWVVV Batchsize here is 1, the training continues to like 50% but then the error occurs with BoundsError: attempt to access 2-element UnitRange{Int32} at index [3] – hellothere Apr 13 '20 at 17:52
  • It’s hard to tell without seeing any code, but Julia is 1 indexed so that may be a factor. – logankilpatrick Apr 14 '20 at 13:15
  • 1
    i posted the code on the link above. but i found the error, it was the outputlayer which had size 2. i forgot to changed it to 4, since i use 4 datasets now and not 2 anymore. – hellothere Apr 14 '20 at 16:27
  • Can you add this as an answer to the question for completeness? – logankilpatrick Apr 16 '20 at 12:03

1 Answers1

0

Found the error, it was the outputlayer which had size 2. I forgot to change it to 4, since I use 4 datasets now and not 2 anymore. Thanks to everyone investigating.

hellothere
  • 47
  • 3