# How does pytorch’s batch norm know if the forward pass its doing is for inference or training?

**URL:** <https://discuss.pytorch.org/t/how-does-pytorch-s-batch-norm-know-if-the-forward-pass-its-doing-is-for-inference-or-training/16857>\
**Category:** Uncategorized\
**Created:** [April 24, 2018, 12:08am UTC](https://discuss.pytorch.org/t/how-does-pytorch-s-batch-norm-know-if-the-forward-pass-its-doing-is-for-inference-or-training/16857 "2018-04-24T00:08:48Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Alpha](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alpha/32/25271_2.png) [@Alpha](https://discuss.pytorch.org/u/Alpha)\
**Post date:** [April 24, 2018, 1:06am UTC](https://discuss.pytorch.org/t/how-does-pytorch-s-batch-norm-know-if-the-forward-pass-its-doing-is-for-inference-or-training/16857/10 "2018-04-24T01:06:25Z")

</div>

I see.

As far as I know, the flag self.training just make a difference in the Dropout and Batch Norm layers,  
so if you don’t use these two types of layer, it may don’t have influence.

---

_[View the full topic](https://discuss.pytorch.org/t/how-does-pytorch-s-batch-norm-know-if-the-forward-pass-its-doing-is-for-inference-or-training/16857)._
