Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.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图中看到发送节点和接收节点吗?_Python_Tensorflow - Fatal编程技术网

Python 我们能在tensorflow图中看到发送节点和接收节点吗?

Python 我们能在tensorflow图中看到发送节点和接收节点吗?,python,tensorflow,Python,Tensorflow,我们可以在tensorflow GraphDef中或通过使用python API查看发送节点和接收节点吗 我尝试以下代码 import tensorflow as tf with tf.device("/gpu:0"): x = tf.constant(1.0) with tf.device("/gpu:1"): y = tf.constant(2.0) with tf.device("/cpu:0"): sum = tf.add(x, y) graph_def =

我们可以在tensorflow GraphDef中或通过使用python API查看发送节点和接收节点吗

我尝试以下代码

import tensorflow as tf

with tf.device("/gpu:0"):
    x = tf.constant(1.0)
with tf.device("/gpu:1"):
    y = tf.constant(2.0)
with tf.device("/cpu:0"):
    sum = tf.add(x, y)

graph_def = tf.get_default_graph().as_graph_def()
print(graph_def)

但是
图形中没有发送/接收节点。是否有任何发送/接收节点添加到图形中,用于将
x
y
传输到cpu?

发送和接收节点仅在您第一次尝试执行图形时添加到图形中,调用。。。实际上,添加的send和recv节点集将取决于在该调用中馈送和获取的特定张量

通过将
tf.RunOptions(output\u partition\u graphs=True)
传递给
Session.run()
调用,可以看到在每个设备(包括发送和接收节点)上执行的精确图形,如下所示:

options = tf.RunOptions(output_partition_graphs=True)
metadata = tf.RunMetadata()

sess.run(..., options=options, metadata=metadata)

for partition_graph_def in metadata.partition_graphs:
    print partition_graph_def  # Contains all the nodes that ran on a single device.

send和recv节点仅在您第一次尝试执行图形时添加到图形中,调用。。。实际上,添加的send和recv节点集将取决于在该调用中馈送和获取的特定张量

通过将
tf.RunOptions(output\u partition\u graphs=True)
传递给
Session.run()
调用,可以看到在每个设备(包括发送和接收节点)上执行的精确图形,如下所示:

options = tf.RunOptions(output_partition_graphs=True)
metadata = tf.RunMetadata()

sess.run(..., options=options, metadata=metadata)

for partition_graph_def in metadata.partition_graphs:
    print partition_graph_def  # Contains all the nodes that ran on a single device.

如果是分布式配置,这两个节点如何传递张量?通过gRPC?thxYes,分布式设置中机器之间的默认传输使用gRPC传输张量内容。但是,还可以使用其他传输,包括MPI和RDMA谓词。这里的架构文档对其工作原理有一个高层次的概述:thx很多!我现在深入研究分布式TensorFlow如何在运行时传递protobuf信息的细节,
rendezvous\u mgr
rpc\u rendezvous\u mgr
base\u rendezvous\u mgr
之间的区别是什么?中有一些讨论,但这确实是一个太大的问题,无法用600个字符的注释来处理!如果这不是一个合适的讨论方式,请让我知道。但还是非常感激!如果是分布式配置,这两个节点如何传递张量?通过gRPC?thxYes,分布式设置中机器之间的默认传输使用gRPC传输张量内容。但是,还可以使用其他传输,包括MPI和RDMA谓词。这里的架构文档对其工作原理有一个高层次的概述:thx很多!我现在深入研究分布式TensorFlow如何在运行时传递protobuf信息的细节,
rendezvous\u mgr
rpc\u rendezvous\u mgr
base\u rendezvous\u mgr
之间的区别是什么?中有一些讨论,但这确实是一个太大的问题,无法用600个字符的注释来处理!如果这不是一个合适的讨论方式,请让我知道。但还是非常感激!