从图中删除节点或重置整个默认图 [英] Remove nodes from graph or reset entire default graph

查看:45
本文介绍了从图中删除节点或重置整个默认图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用默认全局图时,是否可以在添加节点后删除节点,或者将默认图重置为空?在 IPython 中以交互方式使用 TF 时,我发现自己不得不反复重新启动内核.如果可能,我希望能够更轻松地对图表进行实验.

When working with the default global graph, is it possible to remove nodes after they've been added, or alternatively to reset the default graph to empty? When working with TF interactively in IPython, I find myself having to restart the kernel repeatedly. I would like to be able to experiment with graphs more easily if possible.

推荐答案

更新 11/2/2016

tf.reset_default_graph()

旧东西

reset_default_graph,但不是公共 API 的一部分(我认为应该是,有人想要 在 GitHub 上提交问题?)

There's reset_default_graph, but not part of public API (I think it should be, does someone wants to file an issue on GitHub?)

我的重置方法是这样的:

My work-around to reset things is this:

from tensorflow.python.framework import ops
ops.reset_default_graph()
sess = tf.InteractiveSession()

这篇关于从图中删除节点或重置整个默认图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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