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、shape =(1,10)、dtype = float32)は、このグラフの要素ではありません)。
あなたのコードは、問題が発生する可能性があり理由は、最初、デフォルトとして使用すると、スコープということですが、あなたはテンソルを置いているところ基本的に混合、それ外に他のテンソルを定義しました。 – Wontonimo
グラフをセッションの引数として渡していますが、それをどのように使用していますか? – Kanwarkajla
代わりに、グラフを定義し、image_data、weights、およびbiasなどのテンソルをすべて定義します。 – Wontonimo