title: how i can create 3d input / 3d output Convolution model with keras?
body: <p>I have a bit question i couldnt solve.</p>
  
  <p>I wanna implement CNN model with fully-connected MLP to my protein database which has 2589 proteins. Each protein has 1287 rows and 69 columns as input and and 1287 rows and 8 columns as output. Actually there was 1287x1 output, but i used one hot encoding for class labels to use crossentropy loss in my model.</p>
  
  <p>Also i want </p>
  
  <p>if we consider as image i have an 3d matrix ** X_train = (2589, 1287, 69) for input** and <strong>y_train =(2589, 1287, 8) output</strong>, i mean output is also matrix.</p>
  
  <p>Below my codes of keras:</p>
  
  <pre><code>model = Sequential()
  model.add(Conv2D(64, kernel_size=3, activation="relu", input_shape=(X_train.shape[1],X_train.shape[2])))
  model.add(Conv2D(32, kernel_size=3, activation="relu"))
  model.add(Flatten())
  model.add(Dense((8), activation="softmax"))
  </code></pre>
  
  <p>But I encountered with Error about Dense layer :</p>
  
  <pre><code>ValueError: Error when checking target: expected dense_1 to have 2 dimensions, but got array with shape (2589, 1287, 8)
  </code></pre>
  
  <p>Ok, i understand that Dense should take positive integer unit (explanation in Keras docs. ). But how i can implement matrix output to my model ?</p>
  
  <p>I tried that:</p>
  
  <pre><code>model.add(Dense((1287,8), activation="softmax"))
  </code></pre>
  
  <p>and something else but i couldnt find any solution.</p>
  
  <p>Thanks very much.</p>