tf2.0 ValueError:You are trying to load a weight file containing 2 layers into a model with 0 layers
tensorflow2.0版本,通过继承tf.keras.Model类自定义网络结构,当加载之前训练过的模型参数时报错ValueError:Youaretryingtoloadaweightfilecontaining2layersintoamodelwith0layers。网上有说改成model.load_weights('model_name.h5',by_name=True)试了下还是报错。