Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.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 Tensorflow会话运行调用转换为Tensorflow';s C++;美国石油学会 我想知道如何调用Tensorflow的C++ API。< /P>_Python_C++_Tensorflow - Fatal编程技术网

如何将Python Tensorflow会话运行调用转换为Tensorflow';s C++;美国石油学会 我想知道如何调用Tensorflow的C++ API。< /P>

如何将Python Tensorflow会话运行调用转换为Tensorflow';s C++;美国石油学会 我想知道如何调用Tensorflow的C++ API。< /P>,python,c++,tensorflow,Python,C++,Tensorflow,我有以下Python代码: with open("logfile.txt", "w") as logFile: logFile.write("detection_boxes=" + str(detection_boxes)) logFile.write("detection_scores=" + str(detection_scores)) logFile.write("detection_classes=" + str(detection_classes)) l

我有以下Python代码:

with open("logfile.txt", "w") as logFile:
    logFile.write("detection_boxes=" + str(detection_boxes))
    logFile.write("detection_scores=" + str(detection_scores))
    logFile.write("detection_classes=" + str(detection_classes))
    logFile.write("num_detections=" + str(num_detections))
    logFile.write("image_tensor=" + str(image_tensor))

(boxes, scores, classes, num) = sess.run(
    [detection_boxes, detection_scores, detection_classes, num_detections],
    feed_dict={image_tensor: image_np_expanded})
其中,检测盒、检测分数、检测类、数量检测和图像张量都是张量。将str()应用于print语句时,它们如下所示:

detection_boxes=Tensor("detection_boxes:0", dtype=float32)
detection_scores=Tensor("detection_scores:0", dtype=float32)
detection_classes=Tensor("detection_classes:0", dtype=float32)
num_detections=Tensor("num_detections:0", dtype=float32)
image_tensor=Tensor("image_tensor:0", shape=(?, ?, ?, 3), dtype=uint8)

但是,Tensorflow的C++ API的会话运行()调用似乎有不同的签名。在第h次会议上

虚拟状态运行(const std::vector>和输入,const std::vector和输出\u张量\u名称,const std::vector和目标\u节点\u名称,std::vector*输出)=0

看起来,C++ API期望向量而不是张量的列表/集合。

如何调用具有Python代码的等效参数的C++ API?< /P> 非常感谢您事先的帮助