# Batching issues

**URL:** <https://discourse.julialang.org/t/batching-issues/16444>\
**Category:** Machine Learning\
**Created:** [October 17, 2018, 2:24pm UTC](https://discourse.julialang.org/t/batching-issues/16444 "2018-10-17T14:24:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdwfrost](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdwfrost/32/2831_2.png) [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Post date:** [October 17, 2018, 2:24pm UTC](https://discourse.julialang.org/t/batching-issues/16444/1 "2018-10-17T14:24:39Z")

</div>

Hi all,

I’m trying to get my head around how Flux deals with batching. I can see how the [mlp.jl](https://github.com/FluxML/model-zoo/blob/master/vision/mnist/mlp.jl) example works in the model zoo - making one big batch using hcat, then using repeated((X,Y),200) to effectively go through 200 epochs. I have a couple of questions:

1. If X isn’t turned into a single batch i.e.

```julia
X = float.(reshape.(imgs, :))

```

what tweaks need to be made e.g. to the loss and accuracy functions.

1. How do I tweak the file to allow e.g. minibatches of 1000?

There was an explicit section on batching in the old (\<0.3) API documentation, but this has been dropped in recent versions.

Best  
Simon

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 17, 2018, 6:40pm UTC](https://discourse.julialang.org/t/batching-issues/16444/2 "2018-10-17T18:40:49Z")

</div>

You’ll find some batching-related tools in this file

> <https://github.com/FluxML/Flux.jl/blob/master/src/utils.jl>
