title: How to fit a 3D matrix in keras model?
body: <p>I am creating a regression model with keras. I have <code>10</code> <code>145 * 5</code> matrices of ten digits. I am facing problem to fit the <code>10</code> <code>145 * 5</code> matrices in keras model.</p>
  
  <p><code>X</code> is input matrix</p>
  
  <p><code>In: X.shape</code></p>
  
  <p><code>Out: (10, 145, 5)</code></p>
  
  <p><code>y</code> is target matrix</p>
  
  <p><code>In: y.shape</code></p>
  
  <p><code>Out: (10,)</code></p>
  
  <p>For each <code>145 * 5</code> matrix there will be one value in the target matrix</p>
  
  <p><strong>Making the model</strong></p>
  
  <p><code>In: model = Sequential([
      Dense(32, input_dim=145),
      Activation('sigmoid'),
      Dense(output_dim=10)
  ])</code></p>
  
  <p>Although the previous line is not throwing any error or warning but I am quite sure that it is <strong>not</strong> the correct way to fit the model in this case.</p>
  
  <p><code>In: model.compile(optimizer='sgd',loss='mse')</code></p>
  
  <p>No problem so far. But when I am trying to fit the matrices</p>
  
  <p><code>In: model.fit(X, y.reshape(-1, 1))</code></p>
  
  <p>After this line I am getting a long Traceback which ultimately says</p>
  
  <p><code>ValueError: Error when checking model input: expected dense_input_1 to have 2 dimensions, but got array with shape (10, 145, 5)</code></p>
  
  <p>Please help me to correctly fit the matrices in the model. Thanks!</p>