TensorFlow警告-发现未跟踪的函数,如lstm_cell_6_layer_call_and_return_conditional_losses [英] tensorflow warning - Found untraced functions such as lstm_cell_6_layer_call_and_return_conditional_losses
本文介绍了TensorFlow警告-发现未跟踪的函数,如lstm_cell_6_layer_call_and_return_conditional_losses的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是TensorFlow 2.4和TensorFlow的新功能
这里是代码
model = Sequential()
model.add(LSTM(32, input_shape=(X_train.shape[1:])))
model.add(Dropout(0.2))
model.add(Dense(1, activation='linear'))
model.compile(optimizer='rmsprop', loss='mean_absolute_error', metrics='mae')
model.summary()
save_weights_at = 'basic_lstm_model'
save_best = ModelCheckpoint(save_weights_at, monitor='val_loss', verbose=0,
save_best_only=True, save_weights_only=False, mode='min',
period=1)
history = model.fit(x=X_train, y=y_train, batch_size=16, epochs=20,
verbose=1, callbacks=[save_best], validation_data=(X_val, y_val),
shuffle=True)
您知道我为什么收到此警告吗?
推荐答案
我认为可以安全地忽略此警告,因为即使在TensorFlow给出的tutorial中也可以找到相同的警告。保存自定义模型(如图NN)时,我经常看到此警告。只要您不想访问那些不可调用的函数,就应该可以继续。
但是,如果您对这一大段文本感到恼火,可以通过在代码顶部添加以下内容来取消显示此警告。
import absl.logging
absl.logging.set_verbosity(absl.logging.ERROR)
这篇关于TensorFlow警告-发现未跟踪的函数,如lstm_cell_6_layer_call_and_return_conditional_losses的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文