1
#file for inputing the data for testing
from scipy import ndimage
image_file='test.png'
image_data = ndimage.imread(image_file).astype(float)
image_data = image_data.reshape((-1, image_size * image_size)).astype(np.float32)
rst = tf.Graph()
with rst.as_default():
result = tf.matmul(image_data, weights) + biases
picko=tf.nn.softmax(result)
with tf.Session(graph=rst) as rsts:
tf.global_variables_initializer().run()
predictions = rsts.run([picko])
的元素在运行上面的代码我得到下面的错误。请给我建议的解决方案我无法手动解决它。TensorFlow:张量是不是该图
ValueError异常:取参数不能被解释为张量。 (张量张量( “Softmax_4:0”,形状=(1,10),D型细胞= FLOAT32)不是该曲线图的一个要素)
您的代码可能存在问题的原因是,您将默认范围设置为默认值,但您已在其外定义了其他张量,基本上混合了放置张量的位置。 – Wontonimo
我将该图作为参数传递给会话,那么它的用途是什么? – Kanwarkajla
另一种方法是定义一个图并定义其中的所有张量,包括image_data,权重和偏差 – Wontonimo