tensorflow 踩坑记录1,ValueError: Received incompatible tensor with shape (102, 32) when attempting to restore variable with shape (908637, 32) and name embedding_3/embeddings:0.
场景:我有两个数据集,一个是测试数据集,一个是比较正式的数据集,开发一直是测试数据集,切换到比较正式的数据集时,抛的错误ValueError: Received incompatible tensor with shape (102, 32) when attempting to restore variable with shape (908637, 32) and name embedding_3/embeddings:0.
原因:在模型训练结束后保存了权重和参数,在重新跑模型是去加载读取了权重及参数,而文件里保存的是测试数据集的权重参数,从而导致以上错误
解决方案:找到checkpoint相关文件,然后删除就可以解决了
如下:三个文件