2

I decoded a JPEG image and have it in the shape n_samples x n_features as a two-dimensional numpy.ndarray. I feed this to tensorflow as following:

sess.run(train_step, feed_dict={X : train_set.Features, y_ : train_set.labels}) 

This returns a TypeError: TypeError: unhashable type: 'numpy.ndarray'.

I think it is a simple issue, but I cannot find good advise on that. Closest I found was this post on stack overflow but as far as I understand, that's what I do.

2
  • 1
    Can you show us the X, train_set.Features, y_, train_set.labels (and their shapes)? Some of them probably have the wrong shape. Commented Apr 29, 2016 at 22:46
  • Probably your X or y_ is a numpy array, but it should be tf.Tensor or str containing name of endpoint Commented Apr 29, 2016 at 23:23

1 Answer 1

1

I guess your X and train_set.Features maybe have different shape. for examples,

# cifar10 datasets 
x = tf.placeholder(tf.float32,shape = (None,32,32,3))
y = tf.placeholder(tf.float32,shape = (None,10))
print x_batch.shape   # (batch_size,32,32,3)
print y_batch.shape   # (batch_size,10)
# and feed_dict should be
feed_dict = {x:x_batch,y:y_batch}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.