tensorflow keras导包混用

tensoboard

导入:导入包注意

否者会报错 :keras FailedPreconditionError: Attempting to use uninitialized value training/Adam/Variable_9

参考 https://stackoverflow.com/questions/53965588/including-tensorboard-as-a-callback-in-keras-model-fitting-causes-a-failedprecon

真的是翻了一天,发现居然导入包区别会报这种错,sad

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Embedding, LSTM, Bidirectional

load_model h5格式model

报 TypeError: tuple indices must be integers or slices, not list 错

需注意导入包是 tensorflow.keras 还是直接由keras直接导入

sad

load_model 时,存在自定义的loss或layer时

new_model = load_model(r'model.h5', custom_objects={'loss': loss})
原文地址:https://www.cnblogs.com/papio/p/10852695.html