# Model.eval() gives incorrect loss for model with batchnorm layers

**URL:** <https://discuss.pytorch.org/t/model-eval-gives-incorrect-loss-for-model-with-batchnorm-layers/7561>\
**Category:** Uncategorized\
**Created:** [September 19, 2017, 4:25am UTC](https://discuss.pytorch.org/t/model-eval-gives-incorrect-loss-for-model-with-batchnorm-layers/7561 "2017-09-19T04:25:03Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![Felix\_Lessange](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/felix_lessange/32/8959_2.png) [@Felix\_Lessange](https://discuss.pytorch.org/u/Felix_Lessange)\
**Post date:** [August 21, 2018, 2:46pm UTC](https://discuss.pytorch.org/t/model-eval-gives-incorrect-loss-for-model-with-batchnorm-layers/7561/23 "2018-08-21T14:46:55Z")

</div>

Is there any solution to this ? The solution provided in [Performance highly degraded when eval() is activated in the test phase](https://discuss.pytorch.org/t/performance-highly-degraded-when-eval-is-activated-in-the-test-phase/3323/15) only solves partially the problem for me (gain of accuracy, but not the full deal).

This is a post of a problem related to this one I posted months ago [Conflict between model.eval() and .train() with multiprocess training and evaluation](https://discuss.pytorch.org/t/conflict-between-model-eval-and-train-with-multiprocess-training-and-evaluation/21380/2). No new solution is outlined in here.

---

_[View the full topic](https://discuss.pytorch.org/t/model-eval-gives-incorrect-loss-for-model-with-batchnorm-layers/7561)._
