tensfor keras回调有问题

时间:2019-06-03 07:52:45

标签: python tensorflow

我已尝试纠正在tensorflow keras中使用回调时遇到的错误,但该错误仍然存​​在。
    这是我下面的代码和错误。

checkpointer = tf.keras.callbacks.ModelCheckpoint(filepath='bestmodel.h5', verbose=0, save_best_only=True) # model 
earlystopper = tf.keras.callbacks.EarlyStopping(monitor='val_loss', mode='min', min_delta=0.005, patience=20, verbose=0, restore_best_weights=True)

hist = vae.fit(tf_train,
               epochs=max_epochs,
               shuffle=True,
               verbose=0,
               validation_data=tf_val,
               callbacks=[checkpointer, earlystopper])

plot_loss(hist)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-23-a2fa7b74be4e> in <module>()
      7                verbose=0,
      8                validation_data=tf_val,
----> 9                callbacks=[checkpointer, earlystopper])
     10 
     11 plot_loss(hist)

5 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py in set_weights(self, weights)
   1129   def get_input_at(self, node_index):
   1130     """Retrieves the input tensor(s) of a layer at a given node.
-> 1131 
   1132     Arguments:
   1133         node_index: Integer, index of the node

TypeError: object of type 'NoneType' has no len()

0 个答案:

没有答案