Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python KeyError:“;名称';损失:0';指不存在的张量。行动,;损失';,不存在于图表中。”;_Python_Python 3.x_Tensorflow_Tensorboard_Tensor - Fatal编程技术网

Python KeyError:“;名称';损失:0';指不存在的张量。行动,;损失';,不存在于图表中。”;

Python KeyError:“;名称';损失:0';指不存在的张量。行动,;损失';,不存在于图表中。”;,python,python-3.x,tensorflow,tensorboard,tensor,Python,Python 3.x,Tensorflow,Tensorboard,Tensor,KeyError:“名称'loss:0'引用的张量不存在。图形中不存在操作'loss' 嘿,伙计们,我在使用tensorflow模型时遇到了一个问题。在terminal中编译时,代码运行良好,但当我尝试将其设置为python API时,它显示了上述错误 output_layer = 'loss:0' input_node = 'Placeholder:0' # Crop the center for the specified network_input_Size augmented_imag

KeyError:“名称'loss:0'引用的张量不存在。图形中不存在操作'loss'

嘿,伙计们,我在使用tensorflow模型时遇到了一个问题。在terminal中编译时,代码运行良好,但当我尝试将其设置为python API时,它显示了上述错误

output_layer = 'loss:0'
input_node = 'Placeholder:0'

# Crop the center for the specified network_input_Size
augmented_image = crop_center(augmented_image, network_input_size, network_input_size)


with tf.Session() as sess:
    prob_tensor = sess.graph.get_tensor_by_name(output_layer)
    predictions = sess.run(prob_tensor, {input_node: [augmented_image] })
上面的代码表示出现错误


prob\u tensor=sess.graph.get\u tensor\u by\u name(输出层)

不确定是否与您的案例相关,但我在尝试从Azure自定义vision服务运行示例时遇到了相同的错误消息


问题是因为我在导入图形时给了它一个名称,但应该将它作为空字符串保留在这里:
tf.import\u graph\u def(graph\u def,name='')
使用从Azure custom vision service导出的模型时,我遇到了相同的问题。在我的例子中,将输出张量的名称从“loss”改为“model_outputs”有效:

output_layer = 'model_outputs:0'

导出自定义Vision模型时,我遇到了相同的问题。当我使用模型_输出时:0它运行。然而,预测数组没有意义。当我在自定义Vision中测试模型时,我得到了4个对象


但是predicition数组的形状是13X13X40

您是否碰巧解决了这个问题?运行此示例时遇到相同问题:Bgr_image是未定义的参数。将其替换为增强的_图像,因为这是我们对输入图像所做的最后一次修改。它现在适合我了。