title: Call back not working in tensor flow to stop the training
body: <p>I have written a call back which stops training when accuracy becomes 99%.But the problem is i get this error .Sometimes if i resolve this error the call back not get called even though acuurqacy becoms 100 %.</p>
  <p>'&gt;' not supported between instances of 'NoneType' and 'float'</p>
  <pre><code>    class myCallback(tf.keras.callbacks.Callback):
          
          def on_epoch_end(self, epoch, logs={}):
              
              if(logs.get('accuracy') &gt; 0.99):
                  
                  
                 
                 self.model.stop_training = True
  
  
  def train_mnist():
      # Please write your code only where you are indicated.
      # please do not remove # model fitting inline comments.
  
      # YOUR CODE SHOULD START HERE
  
      # YOUR CODE SHOULD END HERE
      call = myCallback()
      mnist = tf.keras.datasets.mnist
  
      (x_train, y_train),(x_test, y_test) = mnist.load_data(path=path)
      # YOUR CODE SHOULD START
      x_train = x_train/255
      y_train = y_train/255
      # YOUR CODE SHOULD END HERE
      model = tf.keras.models.Sequential([
          # YOUR CODE SHOULD START HERE
            keras.layers.Flatten(input_shape=(28,28)),
            keras.layers.Dense(128,activation='relu'),
            keras.layers.Dense(10,activation='softmax')
          # YOUR CODE SHOULD END HERE
      ])
  
      model.compile(optimizer='adam',
                    loss='sparse_categorical_crossentropy',
                    metrics=['accuracy'])
      
      # model fitting
      history = model.fit(# YOUR CODE SHOULD START HERE
            x_train,y_train,epochs=9,callbacks=[call] )
      # model fitting
      return history.epoch, history.history['acc'][-1]
  </code></pre>