title: 'BatchNormalization' is not defined
body: <p>Trying to train a Robust CNN model which is defined as follows:</p>
  <pre><code>from keras.datasets import cifar10
  from keras.utils import np_utils
  from keras import metrics
  from keras.models import Sequential
  from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D, LSTM, merge
  from keras.layers import BatchNormalization
  from keras import metrics
  from keras.losses import categorical_crossentropy
  from keras.optimizers import SGD
  import pickle
  import matplotlib.pyplot as plt
  import numpy as np 
  from keras.preprocessing.image import ImageDataGenerator
  from keras import layers
  from keras.callbacks import EarlyStopping
  
  
  
  def Robust_CNN():
      
      model = Sequential()
      model.add(Conv2D(256, (3, 3), activation='relu', padding='same', init='glorot_uniform', input_shape=(2,128,1)))
      model.add(BatchNormalization())
      model.add(MaxPooling2D(pool_size=(1, 2), padding='valid',  data_format=None))
      model.add(layers.Dropout(.3))
      model.add(Conv2D(128, (3, 3), activation='relu', init='glorot_uniform', padding='same'))
      model.add(BatchNormalization())
      model.add(MaxPooling2D(pool_size=(1, 2), padding='valid', data_format=None))
      model.add(layers.Dropout(.3))
      model.add(Conv2D(64, (3, 3), activation='relu', init='glorot_uniform', padding='same'))
      model.add(BatchNormalization())
      model.add(MaxPooling2D(pool_size=(1, 2), padding='valid', data_format=None))
      model.add(layers.Dropout(.3))
      model.add(Conv2D(64, (3, 3), activation='relu', init='glorot_uniform', padding='same'))
      model.add(BatchNormalization())
      model.add(MaxPooling2D(pool_size=(1, 2), padding='valid', data_format=None))
      model.add(layers.Dropout(.3))
      model.add(Flatten())
      model.add(Dense(128, activation='relu', init='he_normal'))
      model.add(BatchNormalization())
      model.add(Dense(11, activation='softmax', init='he_normal'))
      
      return model
  </code></pre>
  <p>However, when trying to do so I recieve a NameError that <strong>name 'BatchNormalization' is not defined</strong>. The complete error message is as follows:</p>
  <pre><code>---------------------------------------------------------------------------
  NameError                                 Traceback (most recent call last)
  &lt;ipython-input-11-8084d29438f8&gt; in &lt;module&gt;
       55 # &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; choose a model by un-commenting only one of the three &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
       56 #xx_shape = (2,128,1)
  ---&gt; 57 models = Robust_CNN()
       58 #models = CLDNN()
       59 #models = resnet(xx_shape)
  
  ~\AppData\Local\Programs\Python\Python37\Scripts\FYP\Optimizing-Modulation-Classification-with-Deep-Learning-master\Optimizing-Modulation-Classification-with-Deep-Learning-master\Robust_CNN Model\model.py in Robust_CNN()
       19 def Robust_CNN():
       20 
  ---&gt; 21     model = Sequential()
       22     model.add(Conv2D(256, (3, 3), activation='relu', padding='same', init='glorot_uniform', input_shape=(2,128,1)))
       23     model.add(BatchNormalization())
  
  NameError: name 'BatchNormalization' is not defined
  
  </code></pre>
  <p>Can't seem to figure out why this is even when I've already imported BatchNormalization.</p>