title: Tensorflow (python): "ValueError: setting an array element with a sequence" in train_step.run(...)
body: <p>I'm trying to implement a simple logistic regression model trained with my own set of images, but I am getting this error when I try to train the model:</p>
  <pre><code>Traceback (most recent call last):
  File &quot;main.py&quot;, line 26, in &lt;module&gt;
  model.entrenar_modelo(sess, training_images, training_labels)
  File &quot;/home/jr/Desktop/Dropbox/Machine_Learning/TF/Míos/Hip/model_log_reg.py&quot;, line 24, in entrenar_modelo
  train_step.run({x: batch_xs, y_: batch_ys})
  File &quot;/home/jr/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py&quot;, line 1267, in run
  _run_using_default_session(self, feed_dict, self.graph, session)
  File &quot;/home/jr/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py&quot;, line 2763, in _run_using_default_session
  session.run(operation, feed_dict)
  File &quot;/home/jr/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py&quot;, line 334, in run
  np_val = np.array(subfeed_val, dtype=subfeed_t.dtype.as_numpy_dtype)
  ValueError: setting an array element with a sequence.
  </code></pre>
  <p>The data I'm feeding to <code>train_step.run({x: batch_xs, y_: batch_ys})</code> is like this:</p>
  <ul>
  <li>batch_xs: list of tensor objects representing images of 100x100 (10,000 long tensors)</li>
  <li>batch_ys: list of labels as floats (1.0 or 0.0)</li>
  </ul>
  <p>What am I doing wrong?</p>
  <h3>Edits</h3>
  <p>It seems the problem was that I had to evaluate the tensors in <code>batch_xs</code> before passing them to <code>train_step.run(...)</code>. I thought the run method would take care of that, but I guess I was wrong?
  Anyway, so once I did this before calling the function:</p>
  <pre><code>for i, x in enumerate(batch_xs):
      batch_xs[i] = x.eval()
      #print batch_xs[i].shape
      #assert all(x.shape == (100, 100, 3) for x in batch_xs)
  # Now I can call the function
  </code></pre>
  <p>I had several issues even after doing what is suggested in the answers below. I finally fixed everything by ditching tensors and using numpy arrays.</p>