Solved by albanD in post #2 
              
              
                Hi, 
This happens because you use a batchnorm on an input with no spacial size: An input of size (1, 40) has 40 channels only. 
And batchnorm compute normalization for each channel. In this case, since there is a single element, then the renormalization by the standard deviation will divide by 0 and…