title: Error with the dimension of 1DConv input when using tf.data and mode.fit
body: <p>I am using TensorFlow 2.0.0 and trying to create my own data set with tf.data.Dataset.from_generator()</p>
  
  <p>Here are my codes:</p>
  
  <pre class="lang-py prettyprint-override"><code>def trainDatagen():
      for npy in train_list:
          x = tf.convert_to_tensor(np.load(npy), dtype=tf.float32)
          if npy in gbmlist:
               y = to_categorical(0, num_classes=2)
          else:
               y = to_categorical(1, num_classes=2)
          yield x, y
  
  def tfDatasetGen(datagen, output_types, is_training, batch_size):
      dataset = tf.data.Dataset.from_generator(generator=datagen, output_types=output_types)
      if is_training:
          dataset.shuffle(buffer_size=100)
      dataset.repeat()
      dataset.batch(batch_size=batch_size)
      dataset.prefetch(buffer_size=tf.data.experimental.AUTOTUNE)
      return dataset
  
  train_set = tfDatasetGen(
      datagen = trainDatagen, 
      output_types = (tf.float32, tf.float32), 
      is_training = True, 
      batch_size = 16)
  </code></pre>
  
  <p>All those npy files are np.array with shape of [4000,2048] got from large pathology slides with 4000 tiles. Feature of each tile was calculated by ResNet50.</p>
  
  <p>Here is my model:</p>
  
  <pre class="lang-py prettyprint-override"><code>def top_k(inputs, k):
      return tf.nn.top_k(inputs, k=k, sorted=True).values
  
  def least_k(inputs, k):
      return -tf.nn.top_k(-inputs, k=k, sorted=True).values
  
  def minmax_k(inputs, k):
      return tf.concat([top_k(inputs, k), least_k(inputs, k)], axis = -1)
  
  inputs = keras.Input(shape=(4000,2048))
  y = layers.Conv1D(1, 2048, use_bias=False, padding='same', data_format='channels_last')(inputs)
  y = layers.Flatten()(y)
  y = layers.Lambda(minmax_k, arguments={'k': 5})(y)
  y = layers.Dense(units=200, activation=tf.nn.relu)(y)
  y = layers.Dropout(rate=0.5)(y)
  y = layers.Dense(units=100, activation=tf.nn.relu)(y)
  y = layers.Dense(units=2, activation=tf.nn.softmax)(y)
  model = keras.Model(inputs=inputs, outputs=y)
  </code></pre>
  
  <p>When using model.fit() to train the model, I received this:</p>
  
  <pre><code>ValueError: Error when checking input: expected input_4 to have 3 dimensions, but got array with shape (4000, 2048)
  </code></pre>
  
  <p>All this idea is from the paper <strong>arXiv:1802.02212</strong>. Here is the figure of the neural network I tried to reproduce.  </p>
  
  <p><img src="https://i.stack.imgur.com/yXk7W.png" alt="description of CHOWDER architecture"></p>
  
  <hr>
  
  <p>I followed Mahsa Hassankashi's advice to reshape the input to <strong>(4000,2048,1)</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>x = tf.convert_to_tensor(np.load(npy).reshape(4000,2048,1), dtype=tf.float32)
  </code></pre>
  
  <p>and modified this part to fix an error according to GitHub issues:</p>
  
  <pre class="lang-py prettyprint-override"><code>train_set = tfDatasetGen(
      datagen = trainDatagen, 
      output_types = (tf.float32, tf.float32), 
      **output_shapes = (tf.TensorShape((None,None,None)), tf.TensorShape((2,))),**
      is_training = True, 
      batch_size = 16)
  </code></pre>
  
  <p>But I got this:</p>
  
  <pre><code>InvalidArgumentError:  input and filter must have the same depth: 1 vs 2048
  </code></pre>
  
  <p>Finally I tried to reshape the input to <strong>(1,4000,2048)</strong>, this time another kind of error came to me:</p>
  
  <pre><code>InvalidArgumentError:  Expected size[0] in [0, 1], but got 2
  </code></pre>