gpt4 book ai didi

tensorflow - 为什么 tensorflow 抛出 "The graph couldn' t be sorted in topological order”?

转载 作者:行者123 更新时间:2023-12-03 18:50:50 24 4
gpt4 key购买 nike

CUDA:9.0 tensorflow :1.12.0操作系统:Windows 10 x64语言:Python 3.6

相关问题:Tensorflow warning: The graph couldn't be sorted in topological order?但是 tensorflow 图中没有循环。

我的 python 代码:

print(tf.__version__)
activation = tf.nn.relu
img_plh = tf.placeholder(tf.float32, [None, 3, 3, 3])
label_plh = tf.placeholder(tf.float32, [None])
layer = img_plh
buffer = []
ks_list = list(range(1, 10, 1)) + list(range(9, 0, -1))
for ks in ks_list:
buffer.append(tf.layers.conv2d(layer, 9, ks, 1, "same", activation=activation))
layer = tf.concat(buffer, 3)
layer = tf.layers.conv2d(layer, 1, 3, 1, "valid", activation=activation)
layer = tf.squeeze(layer, [1, 2, 3])
loss_op = tf.reduce_mean(tf.abs(label_plh - layer))
optimizer = tf.train.AdamOptimizer()
train_op = optimizer.minimize(loss_op)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
result = sess.run(train_op, {img_plh: np.zeros([2, 3, 3, 3], np.float32), label_plh: np.zeros([2], np.float32)})

运行日志:

1.12.0
2019-01-08 16:33:09.754553: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-01-08 16:33:10.292044: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 860M major: 5 minor: 0 memoryClockRate(GHz): 1.0195
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.64GiB
2019-01-08 16:33:10.292547: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-01-08 16:33:11.477348: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-01-08 16:33:11.477676: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2019-01-08 16:33:11.477844: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2019-01-08 16:33:11.478190: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1392 MB memory) -> physical GPU (device: 0, name: GeForce GTX 860M, pci bus id: 0000:01:00.0, compute capability: 5.0)
2019-01-08 16:33:11.884790: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 0, topological sort failed with message: The graph couldn't be sorted in topological order.
2019-01-08 16:33:11.889780: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 1, topological sort failed with message: The graph couldn't be sorted in topological order.
2019-01-08 16:33:11.917830: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 0, topological sort failed with message: The graph couldn't be sorted in topological order.
2019-01-08 16:33:11.920831: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 1, topological sort failed with message: The graph couldn't be sorted in topological order.

最佳答案

我建议你回滚到tensorflow 1.10.0,它可以解决我机器上的这个问题。这可能是 tensorflow 1.12.0 的一个错误。

更新:我已经发布了问题 here

关于tensorflow - 为什么 tensorflow 抛出 "The graph couldn' t be sorted in topological order”?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54088172/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com