title: How do I shape my input data for use with Conv1D in keras?
body: <p>I have in my dummy dataset 12 vectors of length 200, each vector representing one sample. Let's say <code>x_train</code> is an array with shape <code>(12, 200)</code>. </p>
  
  <p>When I do:</p>
  
  <pre><code>model = Sequential()
  model.add(Conv1D(2, 4, input_shape=(1, 200)))
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>ValueError: Error when checking model input: expected conv1d_1_input to have 3 dimensions, but got array with shape (12, 200)
  </code></pre>
  
  <p>How do I shape my input array correctly?</p>
  
  <p>Here is my updated script:</p>
  
  <pre><code>data = np.loadtxt('temp/data.csv', delimiter=' ')
  trainData = []
  testData = []
  trainlabels = []
  testlabels = []
  
  with open('temp/trainlabels', 'r') as f:
      trainLabelFile = list(csv.reader(f))
  
  with open('temp/testlabels', 'r') as f:
      testLabelFile = list(csv.reader(f))
  
  for i in range(2):
      for idx in trainLabelFile[i]:
          trainData.append(data[int(idx)])
          # append 0 to labels for neg, 1 for pos
          trainlabels.append(i)
  
  for i in range(2):
      for idx in testLabelFile[i]:
          testData.append(data[int(idx)])
          # append 0 to labels for neg, 1 for pos
          testlabels.append(i)
  
  # print(trainData.shape)
  X = np.array(trainData)
  Y = np.array(trainlabels)
  X2 = np.array(testData)
  Y2 = np.array(testlabels)
  
  model = Sequential()
  model.add(Conv1D(1, 1, input_shape=(12, 1, 200)))
  
  opt = 'adam'
  model.compile(loss='mean_squared_error', optimizer=opt, metrics=['accuracy'])
  
  model.fit(X, Y, epochs=epochs)
  </code></pre>
  
  <p>I am now getting a new error:</p>
  
  <pre><code>ValueError: Input 0 is incompatible with layer conv1d_1: expected ndim=3, found ndim=4
  </code></pre>