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

**URL:** https://discourse.julialang.org/t/boundserror-attempt-to-access-n-element-unitrange-int32-at-index-n-1/37508
**Category:** General Usage
**Tags:** knet
**Created:** [April 13, 2020, 2:25pm UTC](https://discourse.julialang.org/t/boundserror-attempt-to-access-n-element-unitrange-int32-at-index-n-1/37508 "2020-04-13T14:25:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jackjacker](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@jackjacker](https://discourse.julialang.org/u/jackjacker)
#### Post date: [April 13, 2020, 2:25pm UTC](https://discourse.julialang.org/t/boundserror-attempt-to-access-n-element-unitrange-int32-at-index-n-1/37508/1 "2020-04-13T14:25:20Z")

</div>

Hello,

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

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

```julia
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?

---

<div class="post-metadata">

### Author: ![jackjacker](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@jackjacker](https://discourse.julialang.org/u/jackjacker)
#### Post date: [April 18, 2020, 10:32am UTC](https://discourse.julialang.org/t/boundserror-attempt-to-access-n-element-unitrange-int32-at-index-n-1/37508/2 "2020-04-18T10:32:27Z")

</div>

found the error, forgot to change the outputlayer to the size of number of datasets.
