I write this code in tensorflow, however, when I run it, the error in the title come out. Can anyone help me and explain the problem to me? Thanks for any help.
import tensorflow as tf
sess = tf.InteractiveSession()
import numpy as np
a = np.array([[1.0,2.0,3.0,4.0],[5.0,6.0,7.0,8.0],[9.0,10.0,11.0,12.0],[1.0,1.0,1.0,1.0]])
w = np.ones([3.0,3.0,1.0,1.0])
W_conv1 = tf.Variable(w)
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
x = tf.placeholder(tf.float64, shape=[4,4])
x_image = tf.reshape(x,[1,4,4,1])
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1))
sess.run(tf.initialize_all_variables())
i,h1 = sess.run(x_image,h_conv1, feed_dict={x:a})
The problem is that you're passing h_conv1 as the second argument to run, which is feed_dict and then specifying the named argument feed_dict as well. If you want multiple ops evaluated, you should pass them as an array in the first argument like this:
i,h1 = sess.run([x_image, h_conv1], feed_dict={x:a})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With