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

150 views Asked by At

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.

1

There are 1 answers

0
hellothere On

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.