# How does batch norm behave in pytorch depending if one is in training mode or eval/inference mode?

**URL:** <https://discuss.pytorch.org/t/how-does-batch-norm-behave-in-pytorch-depending-if-one-is-in-training-mode-or-eval-inference-mode/16858>\
**Category:** Uncategorized\
**Created:** [April 24, 2018, 1:01am UTC](https://discuss.pytorch.org/t/how-does-batch-norm-behave-in-pytorch-depending-if-one-is-in-training-mode-or-eval-inference-mode/16858 "2018-04-24T01:01:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Brando\_Miranda](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/brando_miranda/32/14355_2.png) [@Brando\_Miranda](https://discuss.pytorch.org/u/Brando_Miranda)\
**Post date:** [September 8, 2021, 7:51pm UTC](https://discuss.pytorch.org/t/how-does-batch-norm-behave-in-pytorch-depending-if-one-is-in-training-mode-or-eval-inference-mode/16858/2 "2021-09-08T19:51:09Z")

</div>

> [@How does pytorch’s batch norm know if the forward pass its doing is for inference or training?](https://discuss.pytorch.org/t/how-does-pytorch-s-batch-norm-know-if-the-forward-pass-its-doing-is-for-inference-or-training/16857):
>
> how does pytorch’s batch norm know if the forward pass its doing is for inference or training? I am evaluating the the test performance of my net but realized that I’m not sure how my net knows if its training phase or inference phase. How does pytorch handle this?

---

_[View the full topic](https://discuss.pytorch.org/t/how-does-batch-norm-behave-in-pytorch-depending-if-one-is-in-training-mode-or-eval-inference-mode/16858)._
