Feeding dtype np.float32 to TensorFlow placeholder
<p>I am trying to feed an numpy ndarray of type : float32 to a TensorFlow placeholder, but it's giving me the following error:</p>

<pre><code>You must feed a value for placeholder tensor 'Placeholder' with dtype float
</code></pre>

<p>My place holders are defined as:</p>

<pre><code>n_steps = 10
n_input = 13
n_classes = 1201

x = tf.placeholder("float", [None, n_steps, n_input])
y = tf.placeholder("float", [None, n_classes])
</code></pre>

<p>And the line it's giving me the above error is:</p>

<pre><code>sess.run(optimizer, feed_dict={x: batch_x, y: batch_y})
</code></pre>

<p>where my batch_x and batch_y are numpy ndarrays of dtype('float32').  The following are the types that I printed using pdb:</p>

<pre><code>(Pdb)batch_x.dtype
dtype('float32')
(Pdb)x.dtype
tf.float32
</code></pre>

<p>I have also tried type-casting batch_x and batch_y to tf.float32 as it seems like x is of dtype tf.float32 but running the code with type-casting:</p>

<pre><code>sess.run(optimizer, feed_dict={x: tf.to_float(batch_x), y: tf.to_float(batch_y)})
</code></pre>

<p>gives the following error:</p>

<pre><code>TypeError: The value of a feed cannot be a tf.Tensor object. Acceptable feed values include Python scalars, strings, lists, or numpy ndarrays.
</code></pre>

<p>How should I feed the placeholders? of what type should I use?
Any help/advice will be much appreciated!</p>