Skip to content Skip to sidebar Skip to footer

Tensorflow: How To Feed Numpy.ndarray?

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

Solution 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}

Post a Comment for "Tensorflow: How To Feed Numpy.ndarray?"