1class myCallback(tf.keras.callbacks.Callback):
2 def on_epoch_end(self, epoch, logs={}):
3 if(logs.get('acc')>0.99):
4 print("\nReached 99% accuracy so cancelling training!",epoch)
5 self.model.stop_training = True
6callback=myCallback()
7model.fit(x_training, y_training,callbacks=[callback])