title: Can I feed a deep learning model with a numpy array of two-dimensional arrays?
body: <p>I'm trying to apply deep learning on a certain type of data (I clarify that I'm completely new in the deep learning field).</p>
  
  <p>My problem is that my data have this shape:</p>
  
  <pre><code>array([[list([0.2711662547481215, 0.8077617617949696]),
      list([0.2740944703391002, 0.8077307987902311]),
      list([0.27975517109824677, 0.8105948767285374]), ...,
      list([0.2682358275139472, 0.7961672223420195]),
      list([0.26828227202105487, 0.7963242490089074]),
      list([0.26825241483791423, 0.7962280425298988])],
     [list([0.19316381088239035, 0.5278528814946285]),
      list([0.18176279020905559, 0.5279490879736373]),
      list([0.17593953367503223, 0.5337004661038035]), ...,
      list([0.1874776762264944, 0.3347222452601722]),
      list([0.19028093397692153, 0.3317276803733254]),
      list([0.19318371567115078, 0.3260205351070712])],
     [list([0.29431331243330516, 0.5278639397106065]),
      list([0.2971652263340356, 0.5279137016825076]),
      list([0.3028425144171491, 0.5250098141666806]), ...,
      list([0.3087608716085834, 0.5393921298676885]),
      list([0.3086790408103461, 0.5392881826374951]),
      list([0.3087752472893548, 0.5393158281774402])],
     ...,
     [list([0.1701350761081715, 0.45287817716367823]),
      list([0.17019589629605056, 0.4500627553756753]),
      list([0.17029763188304833, 0.450014099225372]), ...,
      list([0.1700244939483913, 0.4067189720282427]),
      list([0.16734729986011357, 0.4067134429202537]),
      list([0.17002670559158692, 0.40671233709865584])],
     [list([0.23650759422982293, 0.9316270506079255]),
      list([0.23931638108823905, 0.9231288116288199]),
      list([0.23652307573219214, 0.9231332349152112]), ...,
      list([0.25673417707521246, 0.908707792171889]),
      list([0.23367116183146175, 0.8682977535234241]),
      list([0.239428069069617, 0.8567585051503641])],
     [list([0.0, 0.0]), list([0.0, 0.0]), list([0.0, 0.0]), ...,
      list([0.3085728819369571, 0.8452137276693151]),
      list([0.3085463422186099, 0.851007127020198]),
      list([0.3085363898242297, 0.8481662713354454])]], dtype=object)
  </code></pre>
  
  <p>This because each element represent a point, and each point has two coordinates x and y.</p>
  
  <p>This is how I have built my model:</p>
  
  <pre><code>model = models.Sequential()
  
  model.add(layers.Dense(512, activation='relu'))
  model.add(layers.Dense(1024, activation='relu'))
  model.add(layers.Dense(1024, activation='relu'))
  model.add(layers.Dense(1024, activation='relu'))
  model.add(layers.Dense(1, activation='softmax'))
  
  model.compile(optimizer='rmsprop', loss='sparse_categorical_crossentropy', metrics=['acc'])
  </code></pre>
  
  <p>But once I start the training phase</p>
  
  <pre><code>model.fit(x_train, y_train, epochs=10, batch_size=128)
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Epoch 1/10
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-27-3b52916d7a95&gt; in &lt;module&gt;
  ----&gt; 1 model.fit(x_train, y_train, epochs=10, batch_size=128)
  
  ~/.local/lib/python3.6/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
     1237                                         steps_per_epoch=steps_per_epoch,
     1238                                         validation_steps=validation_steps,
  -&gt; 1239                                         validation_freq=validation_freq)
     1240 
     1241     def evaluate(self,
  
  ~/.local/lib/python3.6/site-packages/keras/engine/training_arrays.py in fit_loop(model, fit_function, fit_inputs, out_labels, batch_size, epochs, verbose, callbacks, val_function, val_inputs, shuffle, initial_epoch, steps_per_epoch, validation_steps, validation_freq)
      194                     ins_batch[i] = ins_batch[i].toarray()
      195 
  --&gt; 196                 outs = fit_function(ins_batch)
      197                 outs = to_list(outs)
      198                 for l, o in zip(out_labels, outs):
  
  ~/.local/lib/python3.6/site-packages/tensorflow/python/keras/backend.py in __call__(self, inputs)
     3275         tensor_type = dtypes_module.as_dtype(tensor.dtype)
     3276         array_vals.append(np.asarray(value,
  -&gt; 3277                                      dtype=tensor_type.as_numpy_dtype))
     3278 
     3279     if self.feed_dict:
  
  ~/.local/lib/python3.6/site-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
       83 
       84     """
  ---&gt; 85     return array(a, dtype, copy=False, order=order)
       86 
       87 
  
  ValueError: setting an array element with a sequence.
  </code></pre>
  
  <p>I guess the error is due to my data's format but I don't know how to solve it.</p>