Reputation: 51
I have a model that takes in two inputs, one is a sequence of vectors and the other one is a simple vector, and my output is also a simple vector.
E.g. x1.shape: (50000,50,2) x2.shape: (50000,2) y.shape: (50000,2)
I have successfully trained and evaluated my model using mode.fit
and model.evaluate
with no errors as follows:
model.fit(
x=[x1[:-validationLength], x2[:-validationLength]],
y=y[:-validationLength],
epochs=25,
batch_size=256,
validation_split=0.2,
)
model.evaluate(x=[x1[-validationLength:], x2[-validationLength:]],
y=y[-validationLength:],
batch_size=2)
2147/2147 [==============================] - 18s 9ms/step - loss: 0.0560 - accuracy: 0.8498
But when I try to use my model:
output = model.predict([x1[1000], x2[1000]])
the following error pops up:
ValueError: Data cardinality is ambiguous:
x sizes: 50, 2
Make sure all arrays contain the same number of samples.
IDK how this possible!!!!!
Here is a diagram of the model:
any suggestions will be deeply appreciated!
Upvotes: 1
Views: 77
Reputation: 26708
Maybe you are missing the batch dimension and your first dimensions are being interpreted as the batch dimension, try:
output = model.predict([x1[None, 1000], x2[None, 1000]])
Upvotes: 1