我正在使用tf.train.Saver
save
和restore
保存和恢復TensorFlow模型。在恢復過程中,我正在加載新的輸入數據。該restore
方法拋出這個錯誤:TensorFlow變量名稱 - 保存/恢復中的分配錯誤
InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [1334,3] rhs shape= [1246,3] [[Node: save/Assign_6 = Assign[T=DT_FLOAT, _class=["loc:@Variable_2"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](Variable_2, save/RestoreV2_6)]]
這似乎是說,問題是出在Variable_2
,但一個人如何確定哪些變量的代碼對應於Variable_2
?
謝謝,但我不太以下錯誤。我使用的是保存檢查點來加載檢查點的相同代碼;在保存和恢復之間沒有創建新的變量。 –