My tensorflow 2.6 model has two inputs. When I train this model without validation data - a la model.fit(x=[train_data1, train_data2], y= train_target)
- it works perfectly. When I try to add some validation data, however, I receive errors.
model.fit(x=[train_data1, train_data2], y= train_target,
validation_data=([val_data1, val_data2], val_target))
throws the following error:
Layer Input__ expects 2 input(s), but it received 3 input tensors.
The closest thing I got for help is this question. There, the answerer suggests doing exactly as I have done. What can be done so that this model can use validation_data?
CodePudding user response:
After an hour of beating my head against the wall, I restarted the kernel then tried
model.fit(x=[train_data1, train_data2], y= train_target,
validation_data=([val_data1, val_data2], val_target))
again, just like in the question. It worked...
Like every IT person in the history of the human race will remind you, "Did you try turning it off and on again?" Lesson learned.
CodePudding user response:
try wrapping it in a numpy array or a tensor like this:
validation_data=(np.array([val_data1, val_data2]), val_target)