title: TypeError: Inputs to a layer should be tensors. Got: <PrefetchDataset shapes:
body: <p>I am trying to read data from a few files with tf data pipeline and train a multi input neural network. I train model successfully but when I want to test model then I get this error:</p>
  <pre><code>TypeError: Inputs to a layer should be tensors. Got: &lt;PrefetchDataset shapes: (((None, None), (None, None)), (None,)), types: ((tf.float32, tf.float32), tf.float32)&gt;
  </code></pre>
  <p>Preprocessing Functions:</p>
  <pre><code>def split_chr_by_tab(*lines):
      sep = &quot;,&quot;
      features = [tf.strings.to_number(tf.strings.split(line, sep=sep), out_type=tf.float32) for line in lines]
      return tf.concat(features, axis=0)
  
  def separate_input_output(input):
      return tuple([input[:-6], input[-6:-1]]), input[-1]
  </code></pre>
  <p>Data Pipeline:</p>
  <pre><code>Train_dataset = tf.data.Dataset.list_files(Train_file_list)
  Train_dataset= Train_dataset.shuffle(epoch).repeat(epoch).interleave(lambda filename: tf.data.TextLineDataset(filename).skip(1), num_parallel_calls=25)
  Train_dataset= Train_dataset.map(split_chr_by_tab,num_parallel_calls=tf.data.experimental.AUTOTUNE).map(separate_input_output,num_parallel_calls=tf.data.experimental.AUTOTUNE)
  Train_dataset= Train_dataset.batch(batch_size).prefetch(buffer_size=tf.data.experimental.AUTOTUNE)
  
  Test_dataset = tf.data.Dataset.list_files(Test_file_list)
  Test_dataset= Test_dataset.interleave(lambda filename: tf.data.TextLineDataset(filename).skip(1), num_parallel_calls=25)
  Test_dataset= Test_dataset.map(split_chr_by_tab,num_parallel_calls=tf.data.experimental.AUTOTUNE).map(separate_input_output,num_parallel_calls=tf.data.experimental.AUTOTUNE)
  Test_dataset= Test_dataset.batch(batch_size).prefetch(buffer_size=tf.data.experimental.AUTOTUNE)
  </code></pre>
  <p>Model Training and Evaluation (I get error when predicting on test data):</p>
  <pre><code>inp1 = Input(shape=(1000, ),name=&quot;inp1&quot;)
  inp2 = Input(shape=(4, ),name=&quot;inp2&quot;)
  merge1=concatenate([inp1, inp2])
  first_dense = Dense(32,kernel_initializer=initializer, )(merge1)
  output=dense(1,)(first_dense)
  model = Model(inputs=[inp1, inp2], outputs=output)
  model.fit(Train_dataset,callbacks=callbacks_list,verbose=1,epochs=epoch,steps_per_epoch=10)
  prediction = model(Test_dataset)
  </code></pre>
  <p>Could you please tell me why I get error during prediction? For some reasons, I need to use model(Test_dataset) instead of model.predict(Test_dataset).  Also, how can I store prediction values and true labels?</p>