title: update of TensorFloed led to malfunction of callback,
body: <p>The following codes contain an LSTM model with a callback that stops the training once the training set accuracy reached 90%.</p>
  <p>It was working fine when I used tensorflow-gpu=1.14.</p>
  <pre><code>
  import tensorflow as tf
  from tensorflow.keras.layers import Dense, Dropout,Bidirectional,Masking,LSTM
  from keras_self_attention import SeqSelfAttention
  
  def duo_bi_LSTM_model(X_train, y_train, X_test, y_test, num_classes, loss,batch_size=68, units=128, learning_rate=0.005,epochs=20, dropout=0.2,recurrent_dropout=0.2,optimizer='Adam'):
      
      
      class myCallback(tf.keras.callbacks.Callback):
          def on_epoch_end(self, epoch, logs={}):
              if (logs.get('acc') &gt; 0.90):
                  print(&quot;\nReached 90% accuracy so cancelling training!&quot;)
                  self.model.stop_training = True
                       
      callbacks = myCallback()
  
      
      adamopt = tf.keras.optimizers.Adam(lr=learning_rate, beta_1=0.9, beta_2=0.999, epsilon=1e-8)
      RMSopt = tf.keras.optimizers.RMSprop(lr=learning_rate, rho=0.9, epsilon=1e-6)        
      
      model = tf.keras.models.Sequential()
      model.add(Masking(mask_value=0.0, input_shape=(X_train.shape[1], X_train.shape[2])))
      model.add(Bidirectional(
          LSTM(units, dropout=dropout, recurrent_dropout=recurrent_dropout, return_sequences=True)))
      model.add(Bidirectional(LSTM(units, dropout=dropout, recurrent_dropout=recurrent_dropout)))
      model.add(Dense(num_classes, activation='softmax'))
  
      opt = opt_select(optimizer)
      model.compile(loss=loss,
                    optimizer=opt,
                    metrics=['accuracy'])
  
      history = model.fit(X_train, y_train,
                          batch_size=batch_size,
                          epochs=epochs,
                          validation_data=(X_test, y_test),
                          verbose=1,
                          callbacks=[callbacks])
  
      score, acc = model.evaluate(X_test, y_test,
                                  batch_size=batch_size)
  
      return history, that
  
  
  X_train = np.random.rand(700, 50,34)
  y_train = np.random.choice([0, 1], 700)
  X_test = np.random.rand(100, 50, 34)
  y_test = np.random.choice([0, 1], 100)
  
  batch_size= 217
  epochs = 600
  dropout = 0.6
  Rdropout = 0.7
  learning_rate = 0.00001
  optimizer = 'RMS'
  loss = 'categorical_crossentropy'
  num_classes = y_train.shape[1]
  
  duo_bi_LSTM_his,yhat = duo_bi_LSTM_model(X_train,y_train,X_test,y_test,loss =loss,num_classes=num_classes,batch_size=batch_size,units=32,learning_rate=learning_rate,epochs=epochs,dropout = 0.5,recurrent_dropout=Rdropout,optimizer=optimizer)
  
  </code></pre>
  <p>Following error occurred after I updated the TensorFlow to 2.2.</p>
  <pre><code>~/Speech/Feature_engineering/LXRmodels.py in on_epoch_end(self, epoch, logs)
      103     class myCallback(tf.keras.callbacks.Callback):
      104         def on_epoch_end(self, epoch, logs={}):
  --&gt; 105             if (logs.get('acc') &gt; 0.90):
      106                 print(&quot;\nReached 90% accuracy so cancelling training!&quot;)
      107                 self.model.stop_training = True
  
  TypeError: '&gt;' not supported between instances of 'NoneType' and 'float'
  </code></pre>
  <p>Is it because of the update of TensorFlow causing this problem? How should change the codes?</p>