title: How to train a network in Keras for varying output size
body: <p>I have basic neural network created with Keras. I train the network successfully with  vectors of data and corresponding output data that is a vector with two elements. It represents a coordinate (x, y). So in goes an array, out comes an array. </p>
  
  <p>Problem is that I am unable to use training data where a single input vector should correspond to many coordinates. Effectively, I desire a vector of coordinates as output, without prior knowledge of the number of coordinates.</p>
  
  <p>Network is created by</p>
  
  <pre><code>model = Sequential()
  model.add(Dense(20, input_shape=(196608,)))
  model.add(Dense(10))
  model.add(Dense(2))
  </code></pre>
  
  <p>and model summary shows the output dimensions for each layer </p>
  
  <pre><code>_________________________________________________________________
  Layer (type)                 Output Shape              Param #
  =================================================================
  dense_1 (Dense)              (None, 20)                3932180
  _________________________________________________________________
  dense_2 (Dense)              (None, 10)                210
  _________________________________________________________________
  dense_3 (Dense)              (None, 2)                 22
  =================================================================
  </code></pre>
  
  <p>I realize the network structure only allows a length 2 vector as output. Dense layers also do not accept <code>None</code> as their size. How do I modify the network so that it can train on and output a vector of vectors (list of coordinates)?</p>