TensorFlow 的目标剪枝找不到节点 [英] TensorFlow's target pruning can't find nodes

查看:38
本文介绍了TensorFlow 的目标剪枝找不到节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 TensorFlow API 编写了一个 Python 脚本,包括一个转储图形定义的 SummaryWriter,以便我可以在 TensorBoard 中查看它.

I wrote a Python script using the TensorFlow API, including a SummaryWriter that dumps the graph definition so I can look at it in TensorBoard.

在运行脚本时,会抛出一个 NotFoundErrorPruneForTargets: Some target nodes not found: Reading/data_queue_EnqueueMany_1.顾名思义,有问题的节点是通过 enqueue_manyFIFOQueue 的调用创建的(然后在 QueueRunner 中启动);它确实存在,并且在 TensorBoard 中可以清楚地看到.

When running the script, a NotFoundError is thrown saying PruneForTargets: Some target nodes not found: Reading/data_queue_EnqueueMany_1. As its name implies, the node in question was created by an enqueue_many call on a FIFOQueue (which is then started in a QueueRunner); it does in fact exist, and can be seen clearly in TensorBoard.

什么可能导致 TensorFlow 找不到某些节点?

What could cause TensorFlow to not find some nodes?

推荐答案

这是一个已知问题,当您启动访问 TensorFlow 图(例如您的 QueueRunner)的线程,然后再添加更多节点到图.(底层 tf.Graph 数据结构对于并发读写不是线程安全的.)

This is a known issue that occurs when you start threads that access the TensorFlow graph (e.g. your QueueRunner) before adding more nodes to the graph. (The underlying tf.Graph data structure is not thread-safe for concurrent reads and writes.)

解决方案是移动tf.train.start_queue_runners(sess)(以及任何其他启动线程的代码) 构造最后一个节点之后.仔细检查这一点的一种方法是添加对 的调用tf.get_default_graph().finalize() 紧接在调用 start_queue_runners() 之前.

The solution is to move tf.train.start_queue_runners(sess) (and any other code that starts threads) after the last node is constructed. One way to double-check this is to add a call to tf.get_default_graph().finalize() immediately before calling start_queue_runners().

这篇关于TensorFlow 的目标剪枝找不到节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆