Output None when using batchnorm1d in eval mode?

xiaoyulun: <p>Below is test code</p>
<pre><code class="lang-auto">import torch
import torch.nn as nn
data = torch.rand(3, 10, 145)
bn = nn.BatchNorm1d(10)
bn.eval()
print bn(data) is None
</code></pre>

Mazhar_Shaikh: <p>Hi xiaoyulun,<br>
I have run your test code and do not get output as None.</p>

xiaoyulun: <p>Really <img src="https://discuss.pytorch.org/images/emoji/apple/scream.png?v=9" title=":scream:" class="emoji" alt=":scream:">, which pytorch version do you use?</p>

Mazhar_Shaikh: <p>I tried in Pytorch 0.4 and 1.1.</p>

Mazhar_Shaikh: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/2X/1/1cb333cebc4d5994961eaa0f614d3d5e76eae584.png" data-download-href="https://discuss.pytorch.org/uploads/default/1cb333cebc4d5994961eaa0f614d3d5e76eae584" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/2X/1/1cb333cebc4d5994961eaa0f614d3d5e76eae584.png" alt="image" data-base62-sha1="45Tj7P029yHmwu7zO2cwuCMMIPW" width="690" height="189" data-dominant-color="181818"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">904×248 8.53 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

xiaoyulun: <p>Thanks for your help. Below is my result<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/2X/0/0a4baf00b12332a40d7eee3f182beda34f87a35d.png" data-download-href="https://discuss.pytorch.org/uploads/default/0a4baf00b12332a40d7eee3f182beda34f87a35d" title="Snipaste_2019-08-12_14-51-28"><img src="https://discuss.pytorch.org/uploads/default/optimized/2X/0/0a4baf00b12332a40d7eee3f182beda34f87a35d_2_690x324.png" alt="Snipaste_2019-08-12_14-51-28" data-base62-sha1="1t4VpQwNbXory2vA2RVovmeFO8d" width="690" height="324" srcset="https://discuss.pytorch.org/uploads/default/optimized/2X/0/0a4baf00b12332a40d7eee3f182beda34f87a35d_2_690x324.png, https://discuss.pytorch.org/uploads/default/optimized/2X/0/0a4baf00b12332a40d7eee3f182beda34f87a35d_2_1035x486.png 1.5x, https://discuss.pytorch.org/uploads/default/original/2X/0/0a4baf00b12332a40d7eee3f182beda34f87a35d.png 2x" data-dominant-color="232323"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Snipaste_2019-08-12_14-51-28</span><span class="informations">1274×599 48 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>But when I update pytorch to 1.2.0, the problem is solved</p>

ptrblck: <p>I’ve installed PyTorch <code>1.1.0</code> for Python2.7 and used your code snippet in <code>python</code> and <code>ipython</code>.<br>
Both yield valid results and I cannot reproduce this issue.<br>
Do you also get a <code>None</code> output for <code>nn.BatchNorm2d</code>?</p>
<p>Could you update PyTorch to the latest stable release (<code>1.2.0</code>) and check it again?</p>

xiaoyulun: <p>Yes, When I update pytorch to 1.2.0. It can yield valid results. But I didn’t figure out why it is occured in pytorch 1.1.0</p>

ptrblck: <p>I’m still unsure, how this might happen on your system, as I’ve tried to reproduce it using matching versions of Python, Pytorch etc. and wasn’t able to.</p>