Exception with Callback in Keras - Tensorflow 2.0 - Python
问题 The following code runs a Sequential Keras model, pretty straight forward , on the MNIST data that are packaged with Keras. In running the following piece of code I get an exception. The code is readily reproducible. import tensorflow as tf class myCallback(tf.keras.callbacks.Callback): def on_epoch_end(self, epoch, logs={}): if(logs.get('acc')>0.99): print("\nReached 99% accuracy so cancelling training!") self.model.stop_training = True mnist = tf.keras.datasets.mnist (x_train, y_train),(x