# Why load test data in mini-batches?

**URL:** <https://discuss.pytorch.org/t/why-load-test-data-in-mini-batches/18867>\
**Category:** Uncategorized\
**Created:** [May 29, 2018, 11:16pm UTC](https://discuss.pytorch.org/t/why-load-test-data-in-mini-batches/18867 "2018-05-29T23:16:55Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![yvanscher](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/yvanscher/32/2412_2.png) [@yvanscher](https://discuss.pytorch.org/u/yvanscher)\
**Post date:** [May 30, 2018, 5:44am UTC](https://discuss.pytorch.org/t/why-load-test-data-in-mini-batches/18867/2 "2018-05-30T05:44:59Z")

</div>

memory in many cases for me is the primary reason. you are basically just running a bunch of forward passes through your network. if you have batchnorm layers in your network it is wise to call model.eval() before testing as this will essentially prevent that layer from messing things up if you change the batch size.

see:

> [@What does model.eval() do for batchnorm layer?](https://discuss.pytorch.org/t/what-does-model-eval-do-for-batchnorm-layer/7146/2):
>
> During training, this layer keeps a running estimate of its computed mean and variance. The running sum is kept with a default momentum of 0.1. During evaluation, this running mean/variance is used for normalization. Reference: [http://pytorch.org/docs/master/nn.html#torch.nn.BatchNorm1d](http://pytorch.org/docs/master/nn.html#torch.nn.BatchNorm1d)

---

_[View the full topic](https://discuss.pytorch.org/t/why-load-test-data-in-mini-batches/18867)._
