Remove nodes from graph or reset entire default graph

后端 未结 5 2121
悲&欢浪女
悲&欢浪女 2020-11-28 05:42

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

5条回答
  •  误落风尘
    2020-11-28 06:31

    IPython / Jupyter notebook cells keep state between runs of a cell.

    Create a custom graph:

    def main():
        # Define your model
        data = tf.placeholder(...)
        model = ...
    
    with tf.Graph().as_default():
        main()
    

    Once ran, the graph is cleaned up.

提交回复
热议问题