I am trying to run Keras model.predict function for my Keras model which takes two sepearate set of inputs. 21 for one layer and 7 inputs for the concatenated layer. My data is stored in a numpy array. So I am trying to use the predict function like this. Here is the code:
input1 = np.array([])
input2 = np.array([])
for i in trainX[0,:21]:
np.append(input1,i)
for i in trainX[0,21:]:
np.append(input2,i)
# inputs = np.array([input1,input2])
q = model.predict(input1,input2)
But I keep getting this error:
ValueError Traceback (most recent call last)
<ipython-input-53-ea6beb48f560> in <module>
11 np.append(input2,i)
12 # inputs = np.array([input1,input2])
---> 13 q = model_without_average.predict(input1,input2)
14 # q = model.predict( np.array( [trainX[0,:21],trainX[0,21:]] ))
15 # print(q)
1 frames
/usr/local/lib/python3.8/dist-packages/keras/engine/training.py in predict(self, x, batch_size, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing)
2046 callbacks.on_predict_batch_end(end_step, {'outputs': batch_outputs})
2047 if batch_outputs is None:
-> 2048 raise ValueError('Unexpected result of `predict_function` '
2049 '(Empty batch_outputs). Please use '
2050 '`Model.compile(..., run_eagerly=True)`, or '
ValueError: Unexpected result of `predict_function` (Empty batch_outputs). Please use `Model.compile(..., run_eagerly=True)`, or `tf.config.run_functions_eagerly(True)` for more information of where went wrong, or file a issue/bug to `tf.keras`.
Can anyone tell me how to resolve this error ?
trainX
?